#Leonardogranetto99-transfer-group
1 messages ยท Page 1 of 1 (latest)
Hello ๐
I will need some more details about your integration. Are you using Stripe Connect? If yes, what is the type of accounts you're working with?
Yes I'm using Stripe Connect. And I'm using express accounts.
Users can create seller accounts and they have to go through the stripe onboarding process. After that I save their stripe connect ID in my data base into their user account. They create Products and users can shop and select all kinds of products, add them to a cart and then go though a checkout process.
I create the products in my database. I don't use the stripe product object.
inside checkout.session.create I pass in a items list inside the line_items field
But those Items are from different sellers.
const session = await this.stripe.checkout.sessions
.create({
payment_method_types: paymentMethods,
line_items: itemList,
mode: mode,
success_url: A.absoluteUrl(
`${successURL}?${mode === 'payment' ? 'payment' : 'subscription'}=${client_reference_id}`,
),
cancel_url: A.absoluteUrl(
`${cancelURL}?${mode === 'payment' ? 'payment' : 'subscription'}=${client_reference_id}`,
),
client_reference_id,
customer_email: user.email,
...(stripe_connectID
? {
payment_intent_data: {
application_fee_amount: 123,
transfer_data: {
destination: stripe_connectID,
},
},
}
: {}),
})
My wish is to send the individual connect account their money, but I only found a way to pass one connectID
...(stripe_connectID
? {
payment_intent_data: {
application_fee_amount: 123,
transfer_data: {
destination: stripe_connectID,
},
},
}
: {}),
Ah okay.
Is there any specific reason why you can't use source_transaction instead of transfer_group?
I haven't heard of source_transaction yet ๐ค can I use it with checkout sessions?
Ah okay.
Yes you can use it with checkout sessions but not in the same way as transfer_data. transfer_data accepts only one destination ID. source_transaction can be used to distribute the money between multiple connect accounts by creating transfers once the checkout session is completed.
You'd need to listen to checkout.session.completed webhook event and when a checkout session is completed, you can initiate transfers server side where you can specify the charge as well as the destination.
For example,
https://stripe.com/docs/connect/charges-transfers#transfer-availability
const transfer = await stripe.transfers.create({
amount: 1000,
currency: "chf",
source_transaction: "{CHARGE_ID}",
destination: "{{CONNECTED_STRIPE_ACCOUNT_ID}}",
});
you mean like that for every connected Account?
and through the 'checkout.session.completed' event I'll get the chargeID
Yup that is correct
Thanks. I'll try it ๐
After creation of the transfer, is there anything else I have to do? Or does Stripe assume from there on?
Yup once you create the transfer you should be good to go.
I need to step away now but @runic surge can help you if you have any follow up questions ๐
Ok thank you hanzo and hi pompey ๐ But I think I have every information I need ๐
Great to hear! Let me know if you do run in to anything