#juiceman

1 messages · Page 1 of 1 (latest)

warped coveBOT
prime ice
strong veldt
#

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

prime ice
#

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?

strong veldt
#

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?

prime ice
#

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

strong veldt
#

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',
});

prime ice
#

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?

strong veldt
#

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

#

1 sec

#

i think that works!

#

let me make some charges and see whats good

#

thank you!

#

toby for president 2024

strong veldt
#

works really good!

spark plinth
#

Yes, that is what that is saying. The funds will become available two days after they show up in the account's pending balance

strong veldt
#

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,
});

spark plinth
#

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.

strong veldt
#

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',
});

spark plinth
#

The bank account attached to the account that that link is filling out yes.

strong veldt
#

wooopi!

#

thank u

#

if the funds r still there in two days i will be back lol