Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simulate Stripe Subscription Renewal Failure [closed]

I'm trying to test different Stripe Subscription failures. Specifically, what happens when an active subscription gets renewed when initially the card got accepted and the subscription is active, but the renewal payment gets declined, or the customer deletes the card during the subscription.

How can I simulate this on Stripe?

like image 436
Charlie Fish Avatar asked Sep 09 '16 02:09

Charlie Fish


People also ask

How do I deal with failed subscription payments on Stripe?

If a payment fails for a subscription invoice, your customers can use the Stripe-hosted page to: View the details and amounts for the failed invoice and the associated subscription. Add a new card payment method for their subscription for the payment that's due and for future subscription payments.

How do I reactivate Cancelled Stripe subscription?

A canceled subscription can't be restarted, so you must create a new one for the customer if you want to continue billing them. If you choose to cancel at the end of the period, cancel_at_period_end is set to true and the subscription cancels at the end of the current billing period.

Why is my Stripe subscription status incomplete?

The subscription remains in status incomplete and the invoice is open during this time. If your customer pays the invoice, the subscription updates to active and the invoice to paid . If they don't make a payment, the subscription updates to incomplete_expired and the invoice becomes void .


1 Answers

In order to test failed subscription payments, you can do something like this:

  1. Create the customer with a card token for a valid card (e.g. 4242 4242 4242 4242) in the source parameter.

  2. Create the subscription to the plan. The subscription will be successfully created since the first charge will succeed.

  3. Update the customer with a card token for a failing card (e.g. 4000 0000 0000 0341) in the source parameter.

  4. Update the subscription with the trial_end parameter set to a few seconds in the future and prorate set to false. This effectively changes the next billing date for the subscription.

Once the trial_end date is reached, a new billing period will start and an invoice will be created. After approximately one hour, the invoice will be closed and payment will be attempted. What happens then is decided by your subscription account settings.

To test your second scenario, you can simply change step 3 above to delete the card instead of updating the customer with a failing card.

like image 94
Ywain Avatar answered Oct 21 '22 13:10

Ywain