I'm using the Stripe API and I'd like to present my customer's a list of their invoice history along with the relevant receipts.
I can't find anywhere in the Stripe API (https://stripe.com/docs/api?lang=php) that allows me fetch a list of a customer's receipts. Is there something I'm missing?
Stripe can automatically send email receipts after a successful payment, or when you refund one. This is done by providing an email address when making the API request, using the email address of a Customer object, or updating a PaymentIntent with a customer's email address after checkout.
You can use Stripe's prebuilt email receipts, or use receipt data from the Stripe API and your Terminal integration to generate on-brand custom receipts.
On the Invoices page, click through the tabs at the top to view invoices according to their status. To filter your invoices in more detail, click Filter. Stripe gives you the option to filter your invoices by frequency, status, creation date, due date, and more.
Each invoice includes a charge
property which contains the id of its last charge. This will either be the current/final payment attempt (for invoices not successfully paid) or the successful payment (for paid invoices).
This allows you to easily use the charge and invoice data to present a receipt to the user, but a "receipt" is itself more of an application-side notion; its needs and presentation vary with the application.
Once you've got the data, you can present a receipt however you like.
Ideally, I recommend caching these records locally. It's almost painless to do if you're receiving webhooks. You can then model (and search!) a local receipt record as best fits your needs, your customer then gets the benefit of very fast billing display, and we all get the benefit of less load on Stripe's API endpoints.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With