#Dhaval
1 messages · Page 1 of 1 (latest)
hello! if you're asking if the invoice.paid event contains card details - no, it doesn't. If you're asking if you can retrieve the card details from the PaymentIntent id found in the invoice.paid event, yes you can
If you're asking if you can retrieve the card details from the PaymentIntent id found in the invoice.paid event, yes you can.
Yes, I am asking about the upper question. Can you please let me know how can I get card details?
retrieve the PaymentIntent using : https://stripe.com/docs/api/payment_intents/retrieve and expand [0] the latest_charge
can you share the request id [0]? it'd look like req_xxx
req_fJvBP1f7jqpo5I
this request is to pay an invoice, there's no error message there
are you sure you shared the correct request id?
if you log in and view the request : https://dashboard.stripe.com/test/logs/req_fJvBP1f7jqpo5I
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
there's no error message
req_fJvBP1f7jqpo5I isn't to retrieve a PaymentIntent
But also in of https://dashboard.stripe.com/test/logs/req_fJvBP1f7jqpo5I response i didn't get card details
i think there's some miscommunication here
you asked if there's any way to retrieve the card details from the PaymentIntent id found in the invoice.paid event
to do so, you need to retrieve the PaymentIntent using : https://stripe.com/docs/api/payment_intents/retrieve and expand [0] the latest_charge
have you made this API request : https://stripe.com/docs/api/payment_intents/retrieve?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
please check above
alright, what's the response that you received?
i can't see it since we don't log responses for GET requests
i got below response
No such payment_intent: 'pi_3MOhuVRRjbuC3zef0TrZ60XV'
pi_3MOhuVRRjbuC3zef0TrZ60XV is on the connected account, so you need to use the Stripe-Account header [0] when making the request with your platform's secret key : https://stripe.com/docs/connect/authentication
example
const paymentIntent = await stripe.paymentIntents.retrieve(
'pi_...',
{
expand: ["latest_charge"]
},
{stripeAccount: 'acct_...'}
);
Great. got it Thanks 👐
just so you're aware, you don't actually have to retrieve the PaymentIntent
you could retrieve the Charge directly instead
since the Invoice has a Charge : https://stripe.com/docs/api/invoices/object#invoice_object-charge
Actually i want the card details like last4digit, expiration dates
have you tried?
what?
have you tried the code i shared - those details should be in the response
yes from webhook I got charged and from that, I call api https://stripe.com/docs/api/charges/retrieve to get the charge details and I got all details.
great!