#joe8912
1 messages · Page 1 of 1 (latest)
Hi, are you asking how you can attain the charge ID after a Checkout Session succeeds?
yes please
I highly recommend that you watch this explanation on how our objects relate to each other, https://stripe.com/docs/payments/tour#payment-objects. It's very helpful.
You can listen to the checkout.session.completed event, https://stripe.com/docs/api/events/types#event_types-checkout.session.completed which would have the Payment Intent, https://stripe.com/docs/api/checkout/sessions/object?lang=php#checkout_session_object-payment_intent ID. You can then retrieve the Payment Intent, and look at https://stripe.com/docs/api/payment_intents/object#payment_intent_object-latest_charge latest charge id.
got it ill give it a look. thank you. I need it so i can transfer like so if session.status == "success":
stripe.Transfer.create(
amount=int(200*100),
currency="usd",
source_transaction=session.payment_intent.charges.data[0].id,
destination="account",
)
I think a better way is to just pass the transfer data when you create the Checkout Session: https://stripe.com/docs/api/checkout/sessions/create?lang=php#create_checkout_session-payment_intent_data-transfer_data
@vapid spoke let me know if you have any questions here. The recommended approach does not require you to write an additional if statement to make the transfer. It's a bit simpler
yes, it is easier but I need to transfer to multiple accounts.
I see
That makes sense
I've shared your feedback to allow multiple transfers in Stripe Checkout for future product reiterations. Thank you.
got it thank you!