#ErreCi
1 messages · Page 1 of 1 (latest)
The easiest way to do this would probably be to list invoices and pass subscription: https://stripe.com/docs/api/invoices/list#list_invoices-subscription
Just curious, why do you need to check status of all related payments?
because i have to rebuild a new db with all subscriptions and single payments done until now...
so i need a logic flow to get all this infos.
According to your knowledge, is there an intelligent method to do this?
Gotcha. Yeah if the subscriptions have a lot of invoices, it may also be useful to use auto pagination in the list invoices request: https://stripe.com/docs/api/pagination/auto
yes I know how to paginate results, but my problem is figuring out what's the smartest way to get a customer's entire payment history.
Why does the list invoice method not work?
The one I shared here:
#1068551913794195558 message
Each invoice you list will also have the corresponding payment intent on it: https://stripe.com/docs/api/invoices/object#invoice_object-payment_intent
ok i got it, last question about it: How do I link a payment intent to a recurring subscription?
So all you have is the payment intent id and you need to know which subscription it belongs to?
If so, Payment Intents have an invoice that you can retrieve or expand: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-invoice. Then on that invoice, you can get Subscription ID: https://stripe.com/docs/api/invoices/object#invoice_object-subscription