#sankalpchari-payment-methods
1 messages · Page 1 of 1 (latest)
HI 👋
You can inspect the Payment Method associated with the Invoice payment
Where are you getting the data?
Webhooks, API responses, etc
i have a site and i need to show which card was used for paymnet , im using php
im getting the card details if its set for subscription in default paymnet method or if its set default for customer
Okay so you can inspect the latest invoice on a subscription
this is the code i have implemnetd
- That's a screenshot
- You should be able to describe this without sharing your code.
- im checking default_paymnet_method on subscription and getting card from there
- if not set then im getting the default card set for customer
issues is if the default payment method is not set and default card is not set on customer
how to fetch the card details
If you retrieve the latest paid invoice for the Subscription, that will include the payment intent and payment method information
I'm not sure I know what you are talking about
on which property in invoice object will i get the paymnet information
For the subscription you can retreive the latest invoice using the latest_invoice property on the Subscription. The invoice will include the ID of a payment intent in the payment_intent property. That Payment Intent, if it has been paid, will include a latest_charge. That Charge object will have the payment_method_details that include the data on the payment method used to pay that Charge
You can get all this data together by using the expand parameter when retrieving the Invoice. https://stripe.com/docs/expand
ok thanks