Reputation: 1098
I am trying to create a custom pdf invoice based of a stripe invoice object using php. One of the fields that I need to show is the payment method and basic details about the payment method(such as the last 4 digits if it was a credit card, last 4 numbers of the bank account if it was a bank transfer, etc...).
How can I find the payment method used by the customer for the invoice in question?
To start off I have the stripe invoice ID which allows me to retrieve the invoice object using the stripe api... How can I get to know if the customer, for this particular invoice used a credit card, bank transfer, etc, and then some more spec details about details about the payment method?
Upvotes: 2
Views: 974
Reputation: 1600
I don't think invoices hold that data inside the object you would need to grab the charge ID (which is inside the invoice object) and retrieve the charge.
Retrieving Invoices - https://stripe.com/docs/api/invoices/object?lang=php
Retrieving Charges - https://stripe.com/docs/api/charges/retrieve?lang=php
Upvotes: 2