Stripe API - Receipts Listing

Chris Bowal picture Chris Bowal · Jun 20, 2014 · Viewed 7.1k times · Source

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?

Answer

colinm picture colinm · Jun 24, 2014

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.