#Fubaibai-paymentintent-transfer
1 messages ยท Page 1 of 1 (latest)
hello, not sure I understand, there isn't a source_transaction on a PaymentIntent. Can you rephrase your question?
Hi, ofc
A customer is performing a purchase, that's ok. But I need to do some transfer after I received a payment_intent.succeeded of this customer
I need to pay some connected account
I read on the doc that i can perform some Transfer
But the customer money is not ready on my balance, so on the doc they said that I can attach a sourceTransaction on the transfer object
TransferCreateParams params =
TransferCreateParams.builder()
.setAmount(1000L)
.setCurrency("usd")
.setSourceTransaction("{CHARGE_ID}")
.setDestination("{{CONNECTED_STRIPE_ACCOUNT_ID}}")
.build();
Transfer transfer = Transfer.create(params);
So, how can I fill the sourceTransaction from the webhook event 'payment_intent.succeeded'
each successful PaymentIntent has a charges array
in the charges array, the most recent Charge would be the successful Charge e.t. ch_123 that was created as part of that PaymentIntent
you pass that under source_transaction: ch_123
ooh let me try rn ๐
Nice that worked ! If I understand well the most recent Charge would be at index 0 right ?
yes, you can look at the Charge's status and it should be succeeded for a PaymentIntent that has status: successful
So if I've an array of Charge > 1 entry, only one entry should have status successful ?
yes
e.g. you have a PaymentIntent, customer tries to pay 3 times, first two times the Charge declines, third time succeeds
so the charges array has all three Charges in it, in reverse chronological order, so
1/ most recent one aka successful
2/ decline
3/ decline
Each decline will trigger payment_intent.payment_failed ?
yes