#sid02960 - Payment Intent
1 messages ยท Page 1 of 1 (latest)
is there anyone ?
ok
While analyzing your event, I see you are using checkout session in order to complete a subscription.
If you want to get the related PaymentIntent, you need to retrieve the latest_invoice.payment_intent of the subscription,
https://stripe.com/docs/api/subscriptions/retrieve
and you pass expand: ['latest_invoice.payment_intent'] in order to expand the response with the payment intent
i m not getting the opayment_intent there also
my moto is to acheive the receipt_ul
receipt_url
Hi there ๐ I'm jumping in as my teammate needed to step away. Please bear with me a moment while I catch up on the context here.
plz let me asap
I'm assuming that you're referring to the receipt_url on the underlying Charge object, but please let me know if that's not what you're looking for.
The chain of objects that you'll want to follow is:
Checkout Session -> Subscription -> Invoice -> Payment Intent -> Charge
I looked at the Invoice associated with the Subscription that you referenced and am seeing that it does have a Payment Intent attached to it.
Is this the field that you're referencing when retrieving the Invoice?
https://stripe.com/docs/api/invoices/object#invoice_object-payment_intent
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Are you looking at the Invoice, or at the Checkout Session?
also i m using test mode
The Checkout Session won't have the Payment Intent value since you're in subscription mode.
From the Checkout Session you find the related Subscription via the subscription field:
https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-subscription
Then you find the associated Invoice via the Subscription's latest_invoice field:
https://stripe.com/docs/api/subscriptions/object#subscription_object-latest_invoice
From the Invoice you find the related Payment Intent via the payment_intent field:
https://stripe.com/docs/api/payment_intents/object
Then find the related Charge via the Payment Intent's charges array:
https://stripe.com/docs/api/payment_intents/object#payment_intent_object-charges
And on the Charge you find the receipt_url:
https://stripe.com/docs/api/charges/object#charge_object-receipt_url