#bilal-paymentintent-apiversion
1 messages · Page 1 of 1 (latest)
Hi there
Yes if there is a Charge associated with it
You would expand the latest_charge
On test env its charging successfully and in the response object it doesn't have latest_charge attribute ?
Can you provide the example PaymentIntent you are looking at?
{ "id": "pi_3N8PgGKv7Wi3E5yl2kK5pR9E", "object": "payment_intent", "amount": 30000, "amount_details": { "tip": {} }, "automatic_payment_methods": null, "canceled_at": null, "cancellation_reason": null, "capture_method": "automatic", "client_secret": "pi_3N8PgGKv7Wi3E5yl2kK5pR9E_secret_G3nej1RlDI4mNxV5F5fPuQ22g", "confirmation_method": "automatic", "created": 1684250452, "currency": "cad", "description": null, "last_payment_error": null, "livemode": false, "next_action": null, "payment_method": "pm_1N8PgrKv7Wi3E5ylzJUr22Ha", "payment_method_types": [ "card" ], "processing": null, "receipt_email": null, "setup_future_usage": null, "shipping": null, "source": null, "status": "succeeded" }
this is the response I'm getting.
Yeah that is your client-side response
We don't share all the data client-side since there is sensitive data that we don't want to expose
You want to pass the PaymentIntent back to your server and then retrieve it using: https://stripe.com/docs/api/payment_intents/retrieve
When you do so you should expand: ['latest_charge'] (see: https://stripe.com/docs/expand for info on expanding responses)
One more question, When I retrieved the PaymentIntent I got the charge object and in charge object it is showing last4 than what is the purpose of expanding response ['latest_charge'] ?
I'm not sure what you mean exactly?
If you don't expand latest_charge then we only respond with the Charge ID
Not the details, which is what will include the last4
In the snap if you see I didn't expanded the latest_charge but i got the last4 in the charge attribute .My question was so why do we need to expand the latest_charge ?
Ah because you are on an older API version.
So you are seeing the charges hash which was removed on the newest API version
So yeah, if you stay with that API version then you don't need to expand latest_charge
bilal-paymentintent-apiversion
(We call out that we removed that has in our changelog here: https://stripe.com/docs/upgrades#2022-11-15)
Got it .
Will use the 2022-11-15 version .
Thankyou 🙂
Sure!