Paul Jose
Paul Jose

Reputation: 13

Find invoice.payment_succeeded against subscription id

My site was down for a week, and few subscription installment was done during the week. But my website did not capture this(using web hook for invoice.payment_succeeded).

I have queried my database and have subscription ids with me. But how do I get the event that triggered invoice.payment_succeeded. So that I can pass the same to web-hook method and database will be updated.

https://api.stripe.com/v1/events?created=1565706893&type=invoice.payment_succeeded

and gets event triggered for invoice.payment_succeeded response during that date.

But at times, I can find no events created during the "paid_at": 1565706893, value. What am I missing here. Or is there any alternate solution to find event id for type invoice.payment_succeeded using subscription id.

Upvotes: 1

Views: 450

Answers (1)

jones
jones

Reputation: 755

https://api.stripe.com/v1/subscriptions/sub_XXXXXX will fetch only latest_invoice id. Are you sure that you take the correct invoice id.

You can also try this if you only want event id associated https://api.stripe.com/v1/events?related_object= SUBSCRIPTIONID&type=invoice.payment_succeeded

Here you can find all the success events created for particular subscription. Hope this helps.(Dosen't know if its official, couldn't find, but you can try)

Upvotes: 2

Related Questions