#juiceman
1 messages · Page 1 of 1 (latest)
Hi 👋 yes, we have the concept of a customer balance:
https://stripe.com/docs/billing/customer/balance
1 sec
mmmm
is that the same system for making transfer?
just making sure that we are talking about the same thing.
a seller sells a good for 10$,
the seller keeps 80% of the sale,
the company keeps 20% of the sale,
this is the code that I am using for that:
// charge the buyer
charge = await stripe.paymentIntents.create({
customer: stripeUserId,
amount: amount,
currency: "usd",
payment_method: campaignCreatorCardToken, // buyer
confirm: true,
description: Campaign id is${campaignId}. Campaign name is ${description}
});
// // from the charge, give 80% of it to the seller
const transfer = await stripe.transfers.create({
amount: charge.amount * .80,
currency: "usd",
source_transaction: charge.latest_charge,
destination: channelOwnerStripeBankAccount.stripeBankId, // seller stripe
});
now I should see 80% of the sale in the seller accounts right? can i use that using customer credit score or is that two different things
Sorry, that doesn't make sense to me. Credit balance and Transfers are separate things. Does the above flow do what you're hoping it will, is that what your testing is showing?
let me take a step back. lets forget about the credit balance.
i would like to see the balance of the transfer on the sellers account, so that can be transfered to their bank account
is that possible?
I'm assuming you're asking about checking the balance of a Connected Account, rather than the balance of the Transfer, our document on account balances contains a snippet showing how to retrieve those:
https://stripe.com/docs/connect/account-balances
1 sec
i think i get it
just to be clear, this is how to create a connected account:
const accountLink = await stripe.accountLinks.create({
account: account.id,
refresh_url: URL,
return_url: URL,
type: 'account_onboarding',
});
Nope, that creates an Account Link, you can see that function requires the ID of an Account as an input so an Account must already be created by that point. Did you try running that snippet and see what the response included?
which snip
this one ?
const balance = await stripe.balance.retrieve({
stripeAccount: '{{CONNECTED_STRIPE_ACCOUNT_ID}}'
});
I am trying to figure out what to put for the account id
but i see what ur saying
i will use account.id for stripeAccount
1 sec
i think that works!
let me make some charges and see whats good
thank you!
toby for president 2024
works really good!
im looking at :https://stripe.com/docs/connect/account-balances#:~:text=pending %2C meaning the funds are,can be paid out now
are the funds pending for 2 days?
just want to make sure that I am reading that corretly.
Yes, that is what that is saying. The funds will become available two days after they show up in the account's pending balance
ok
once that it is available, I can transfer it to a bank using the following snip right?
const transfer = await stripe.transfers.create({
amount: Number(req.body.amount),
currency: 'usd',
destination: stripeBankAccount.stripeBankId,
});
Transfers are for sending money between Stripe accounts. To send money to a bank account you can use payouts https://stripe.com/docs/payouts
And it is actually pretty common to have automatic payouts, so you don't need to write code specifically to create payouts if you go that route.
oh sweet
so if i dont do anything, the money is deposited into the bank account that was created using the snip below?? (if yes, i think i am pretty much almost done here!!!)
const accountLink = await stripe.accountLinks.create({
account: account.id,
refresh_url: 'http://localhost:4200/settings',
return_url: 'http://localhost:4200/settings',
type: 'account_onboarding',
});
The bank account attached to the account that that link is filling out yes.