#xXstekkaXx-balance-reconciliation

1 messages ยท Page 1 of 1 (latest)

fallen dome
#

Hello ๐Ÿ‘‹
Give me a moment to catch up ๐Ÿ™‚ thanks

mortal furnace
#

yes no problem

#

๐Ÿ™‚

woven gazelle
#

That tells us to wait for the funds to land to transfer them.

mortal furnace
#

ok great

knotty minnowBOT
#

This thread has been archived. If you need help with anything else please ask in #dev-help or contact Stripe Support: https://support.stripe.com/contact

mortal furnace
#

Hi I want to wait for a checkout session to be successful and the funds from the checkout session to become available,

To make transfers to the connected accounts

So I put payment_intent of the session in the field "source_transaction" of the various transfers, but it returns me the error:

StripeInvalidRequestError: No such charge: 'pi_3LAb...."

What am I doing wrong?

woven gazelle
#

Thank you!

#

Can you send me the request ID from when you got that error message? (req_123)

mortal furnace
#

sure

woven gazelle
mortal furnace
#

pi_3LAbZ0AqgzZXSfui0j53s8qJ

woven gazelle
#

Thank you, checking in to your request

woven gazelle
#

Do you have the request ID specifically for creating the transfer? I am looking through your account logs now but can jump right to it if you have it on hand

#

Found it

#

Ah, this needs to be a charge ID (ch_123), I was wrong when I said to pass in the PaymentIntent. You can pass in the first Charge in that PaymentIntent's charges list, then the API call should succeed

mortal furnace
#

one sec

#

mmm

#

I'm a little confused

#

what do you mean by "the first charge"?

#

where do I take it?

#

I have the checkout session object, can I take it from there?

woven gazelle
#

Sorry, jumped a couple steps there. So when you get the checkout.session.completed event, the Checkout Session object will have the payment_intent property with the ID you have been using. You can use that ID to retrieve the PaymentIntent. Once retrieved, the PaymentIntent will have a charges array https://stripe.com/docs/api/payment_intents/object#payment_intent_object-charges-data

#

The first element in that charges array, charges.data[0], will be the charge that succeeded. You can pass the ID of that charge in to the create transfer call's source_transaction parameter

mortal furnace
#

ok perfect

woven gazelle
#

Phew, I was typing up a summary because I thought I made it a bit confusing

mortal furnace
#

other charges in the array are always failed?

mortal furnace
woven gazelle
#

Yes, if you are in the checkout.session.completed, that means you have had a successful payment. The first charge in that array will then always be a successful charge. Any other charges in the array will be failed payments in reverse chronological order

mortal furnace
#

thank you very much!

#

๐Ÿ™‚