Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Gabotronix's avatar

Get last 4 digits of card from PaymentIntent object in Stripe PHP

Is it possible to get the last 4 digits of a card from the PaymentIntent object (not same as Charges API) using Stripe PHP SDK?

0 likes
1 reply
Nakov's avatar
Nakov
Best Answer
Level 73

Not really directly, but you can work around that.

Here are all the properties available on the payment intent: https://stripe.com/docs/api/payment_intents/object

So in order to get the last4 you will have to fetch all the payment methods for the customer, and then from the payment intent check which payment_method_types are used for the payment, if card is in it, then from the payment methods you will have the card object, and get the last4 from there.

https://stripe.com/docs/api/payment_methods

Please or to participate in this conversation.