#sid02960 - Payment Intent

1 messages ยท Page 1 of 1 (latest)

gentle laurel
#

๐Ÿ‘‹ Thanks for reaching out

#

@safe glade let's keep talking in this thread

safe glade
#

is there anyone ?

gentle laurel
#

Yes I'm with you

#

just give me couple of minutes while I investigate your request

safe glade
#

ok

gentle laurel
#

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

safe glade
#

i m not getting the opayment_intent there also

#

my moto is to acheive the receipt_ul

#

receipt_url

safe glade
#

?

#

?

#

there

half whale
#

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.

safe glade
#

plz let me asap

half whale
#

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

safe glade
#

we are lagging behing

#

inside invoice i m not getting payment_intent

#

getting null

half whale
#

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

safe glade
#

yes

#

i m getting pyament_intent :"null"

#

im using mode as "subscription'

half whale
#

Are you looking at the Invoice, or at the Checkout Session?

safe glade
#

also i m using test mode

half whale
#

The Checkout Session won't have the Payment Intent value since you're in subscription mode.

safe glade
#

no we want receipt_url

#

ok

half whale
#

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