Testing unpaid subscriptions

989 views
Skip to first unread message

Dan Philibin

unread,
Mar 2, 2016, 11:35:49 AM3/2/16
to Stripe API Discussion
Hi,

It seems there's no way at all to test unpaid subscriptions. Manual retries don't count against the number of retries my settings allow, and because subscription settings are the same across test and live mode, I can't change my subscription settings while testing so that `past_due` subscriptions immediately go into the `unpaid` state. The only way I can think of is to create a bunch of test accounts with invalid cards with the 0341 number and then wait a week (!) until they're switched to the unpaid state, which is obviously unacceptable. Re-opening an unpaid subscription is itself a bit of a complicated procedure, so this is something I need to be able to do as needed. Is there some other solution I'm missing?

(In general, as subscriptions gain more features, the number of edge cases and scenarios that need thoroughly and regularly tested is growing. I'm curious if there's been any consideration of building out better testing tools for subscriptions that allow for creating any combination of scenarios or flows in which a subscription might exist.)

Thanks,

Dan

Remi J.

unread,
Mar 2, 2016, 11:39:16 AM3/2/16
to api-d...@lists.stripe.com
Hey Dan,

You're correct that changing your Recurring settings would impact both Live and Test. To test this, I usually recommend to create a separate Test account where the Recurring settings are adapted to mark a subscription as unpaid after the first failed attempt. Your tests can then use a specific test account and the associated credentials depending on what you are attempting to test at that point so that you can trigger unpaid subscriptions quickly and work with those.

As for improving testing of our subscriptions it's definitely something we're looking into as we know there are edge-cases that are currently hard to reproduce. We don't have a firm timeline to share for a fix unfortunately but we are aware of the pain points!

All the best,
Remi

--
You received this message because you are subscribed to the Google Groups "Stripe API Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss...@lists.stripe.com.
To post to this group, send email to api-d...@lists.stripe.com.
Visit this group at https://groups.google.com/a/lists.stripe.com/group/api-discuss/.

Christopher Cosmo Rogers

unread,
Mar 2, 2016, 11:43:12 AM3/2/16
to Stripe API Discussion
I emailed Stripe support about this a little while ago.

Unfortunately I had to make a new stripe account to test with (so I could change the subscription settings), then make week long subscriptions, then wait a week...
You can make day long subscriptions but there is a known issue with these, they will continually retry forever rather than retry than fail.
Also you have to purchase the sub with a valid test card, then update the payment method to the invalid card.

If anyone knows any better way please let me know!

Chris

Remi J.

unread,
Mar 2, 2016, 11:48:02 AM3/2/16
to api-d...@lists.stripe.com
Hey Chris,

You don't have to wait in that situation. You should open a separate Test account and set the Recurring settings [1] to mark the subscription as unpaid after the first failed attempt. Make sure it's not after a retry and really as soon as it fails. You then follow the usual flow to trigger a failure [2] and force the subscription to be unpaid immediately. This works with any plan not just weekly.

The idea is that you create a customer with the card "4000 0000 0000 0341" and then you create a subscription and pass `trial_end` set as a timestamp a few minutes in the future. This will create a trial period for a few minutes, then the subscription will renew automatically. This will create an invoice that will be attempted one or two hours later. It will fail and the subscription will move to Unpaid as needed. You can also force the invoice to be paid quicker either by clicking "Pay now" in the dashboard or using the Pay Invoice API [3].

Hope this helps!
Remi


--

Christopher Cosmo Rogers

unread,
Mar 2, 2016, 12:55:32 PM3/2/16
to Stripe API Discussion
Hi Remi

Thanks for the info. The thing was we wanted to test the automatic retries, then cancel. Basically after each failed payment attempt we email the customer saying the payment failed, we will retry in X days, then the last email says we will cancel their subscription if it fails again.
So the minimum amount of time we would have waited was at least 3 days (the minimum automatic retry period is a day).

Cheers
Chris

Dan Philibin

unread,
Mar 2, 2016, 12:55:34 PM3/2/16
to api-d...@lists.stripe.com
Got it — thanks Remi.
Reply all
Reply to author
Forward
0 new messages