#Sergei Frolov

1 messages · Page 1 of 1 (latest)

restive hollowBOT
strong lily
#

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

Learn how subscriptions work within Stripe.

wooden comet
#

How can I test this case?

strong lily
#

What do you mean?

wooden comet
#

I set up all by webhook and now I would like to test this case. Can I do it?

strong lily
#

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

Learn how to move Billing objects through time in test mode.

Simulate payments to test your integration.

wooden comet
#

Thanks