#sandy.nozaki
1 messages · Page 1 of 1 (latest)
Order 1 (charge $100, Date: 4/12), Order 2 (Charge $200, Date: 4/13) => Both shipped on same date => How to use multiple charges with a single transfer?
You can set it at a later time, but it can only be set once: https://stripe.com/docs/api/payment_intents/update#update_payment_intent-transfer_group
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
so are you saying that we can set the transfer group whenever we want and doesnt have to be when the payment occurs?
Correct.
can we set transfer_group for multiple paymentintents at once?
or do we have to set transfer_group one by one?
You would need to make multiple requests; one for each Payment Intent
so that wouldnt be multiple charges with a single transfer then? wouldnt that be just 1 charge 1 transfer?
That could still be multiple charges for a single transfer. Just because you add a payment intent to the transfer group, doesn't mean that transfer will automatically be created. You have to create the transfer yourself once all the payments are in the transfer group
so then the transfer should be created once we are ready to transfer?
Correct
mutiple charges => mutilpe update request for paymentintent => single transfer with transfer_group
is this correct?
Yup! Assuming you don't know the transfer group at the time of creation, that's how it would work
do you think you can provide me a sample API for this
There are some examples in our docs: https://stripe.com/docs/connect/charges-transfers
The only difference is you would use this update call to set transfer data: https://stripe.com/docs/api/payment_intents/update#update_payment_intent-transfer_group
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
the sample only shows 1 charge with 1 transfer
what would it look for 2 charges with 1 transfer?
Yeah. You would need to code your own function to make multiple calls
i see there is only one call for the charge...if there is 2...would there be 2 instead?
2 charge with a single transfer:
const paymentIntent1 = await stripe.paymentIntents.create({
amount: 10000,
currency: 'usd',
transfer_group: 'ORDER10',
});
paymentIntent1 = await stripe.paymentIntents.create({
amount: 10000,
currency: 'usd',
transfer_group: 'ORDER10',
});
const transfer = await stripe.transfers.create({
amount: 18000,
currency: 'usd',
destination: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
transfer_group: 'ORDER10',
});
You could do it that way, sure.
what other way is there?
You could nest them in a for-loop as well. Just depends on what you're trying to do.
since we have to set transfer_group in each paymentintent, is it impossible with only one transfer request for multiple charges?
stepping in for my teammate! not sure I follow, is what impossible?
can we set transfer_group for multiple payment intent at once or have to set it one by one?
You can set it for multiple PIs at once
twoshoes said otherwise
right here
okay, let's take a step back. I think we might be misunderstanding each other. what do you mean by "multiple payment intent at once"?
paymentintent would be the charges, no?
so we need to set the transfer_group in each paymentintent?
therefore wouldnt it be impossible with only one transfer request for multiple charges?
can you clarify what your end goal is for separate charges and transfers? an explicit example of what you're trying to do would be helpful
Since the transfer date is determined based on the proof of shipment of the order(21days after or next day), so we're saying that we cannot designate a transfer group in advance at the time of payment.
i think two-shoes said we can set the transfer_group at a later time
so if there is:
Order 1 (charge $100 on 4/12)
Oder 2 (charge $200 on 4/13)
confirmed the shipment on 4/15
how can we use multiple charges with a single transfer?
so do we create the transfer_group and add charges in that group and when we are ready for the transfer for a specific date?
yes, the transfer_group value can be set at a later time. note that it cannot be changed if it has already been set
so it doesnt have to be set with the payment intent ?
transfer_group doesn't have to be set when creating a PaymentIntent
also, using transfer groups is just a way for you to keep track of which charge or charges map to which transfer. you can also just keep track of this information on your end (e.g. which PaymentIntent IDs map to which Transfer IDs)
yeah we prefer to use stripes tracking lol
so if transfer_group doesnt have to be set at the tim eof creating pymentintent
can we just create it like at the end of the day when we know all the charges that need to be included in that specific transfer_group?
yes, i believe that should be okay. i recommend simulating this in test mode to confirm it fits your team's needs
example:
Order 1 (charge $100 on 4/12)
Oder 2 (charge $200 on 4/13)
confirmed the shipment on 4/15
so transfer_group created on 4/15 for transfer
so if we want to transfer 1,000 charges at once, do we have to request the transfer_group set 1000 times?
since it wasnt set at the time of paymentintent, it would need to right?
I think I follow but it's really hard to understand with one-off messages like this
If 1000 charges need to be part of the same transfer group then yes, you'd need to set each of the PaymentIntents' transfer_group values individually
thank you so much
so this means we wouldnt relaly know the final amount until we put all the charges in the transfer_group huh?
wouldn't know the final amount for what exactly?
well since there will be charges refunds etc
and if the transfer_group is created when we want to which is right before the transfer...we wouldnt know the actual amount that will be transferred until we create the transfer_group no?
transfer_group is not required to make a transfer. you can make a transfer without an associated charge or transfer_group
yeah i understand that
i think i just confused us more sorry
i was just worried about whether or not we would know the actual transfer amount before we tie all the charges to 1 transfer_group but im guessing that calculation needs to be done on our side
right, yep. or, as you mentioned, you could determine the transfer amount until all charges are accounted for
ok thank you again!