#Sergei Frolov
1 messages · Page 1 of 1 (latest)
You would want to set up a webhook endpoint to listen for the customer.subscription.updated event and check the Subscription's status: https://stripe.com/docs/api/events/types#event_types-customer.subscription.updated
Here's a blurb about failed payments on subscriptions: https://stripe.com/docs/billing/subscriptions/overview#failed-payments
How can I test this case?
What do you mean?
I set up all by webhook and now I would like to test this case. Can I do it?
Yeah, you just create a Customer with a valid payment method, then proceed with a successful Subscription payment, then update their default payment method and attach this card 4000000000000341, which will fail on the subsequent payment.
I would recommend using a Test Clock to fast-forward the Subscription to a future date in order to get all the events that occur on the second payment attempt.
See here for test cards: https://stripe.com/docs/testing#declined-payments
See here for Test Clocks to test Subscription behavior: https://stripe.com/docs/billing/testing/test-clocks
Thanks