#samzepo-subscription
1 messages · Page 1 of 1 (latest)
@minor stirrup you should listen to events instead to reconcile data. but https://stripe.com/docs/api/subscriptions/list will always have the most recent subscription first (that's true for all lists)
You mean listen the webhook events, right?
yes
Okay, but if I want to retry in the moment. For example:
- User click on finish payment
- I sent subscription create to Stripe
- Stripe creates successfully the subscription
- Stripe confirm me the subscription was created
- I start another internal process (not with Stripe)
- My endpoint failed with a Status 5XX (for any reason)
In this moment the subscription was created, the payment was charged to my customer but unfortunately my endpoint crash and I need to check if the payment was charged to my customer. If yes, then I need to run another process to give access to my customer to my platform.
I hope to be clear with my situation
So, this is the reason I thought I can use "list subscriptions" with parameter "customer" in this process (if my endpoint failed I can retry and provide the best experience to my customer)
https://stripe.com/docs/api/idempotent_requests that's what you should use
you would basically re-do the same request with the same parameters and be guaranteed to only get one subscription/payment
Great, let me check this on my side.
Even, if I want to use an extra method to know if the subscription/payment was successfully. Can I use the previous mentioned method ("list subscriptions" with parameter "customer") to know if subscription is active, then the payment was successfully?