Forums/Community/Community Support

Answered

How to force subscription to 'past_due' state?

afurmanov
asked this on January 21, 2011 07:31 pm

I want to write an integration test checking if app handles correctly a situation when payment has not been received. That is what I've tried to achieve this
1. Create a valid subscription with valid card "1"
2. Update card to "2" (invalid card)
3. Apply some charge to subscription created on step "1", this step fails as it should
4. Now I expect to find a subscription in 'past_due' or 'unpaid' state, however subscription state is 'active'
The other way would be to wait until the end of billing cycle, so chargify would try to apply a recurring subscription charge, but that does not really work well for automated tests.
Ideally I want to ask chargify to do something like "retry charges and update subscription statuses and call all webhooks." Is there any way to do this?
Thanks!

 

Comments

User photo
Lance Walley
Chargify

Hey there,

I'm not technical enough to help here, but there are some great & gracious developers out there who can help sometimes.

I'm going to tweet this and we'll see if anyone pops in to help you. We have a great community!

Thanks.

--- Lance

January 21, 2011 10:14 pm
User photo
Evan Coonrod

Has the great community come up with an answer to this?

January 02, 2012 03:23 pm
User photo
Lance Walley
Chargify

Hey, I just got this from our developers:

Update the card on the subscription to "2".
Set the next billing date to a minute or two away.
Wait max 20 minutes.
It will simulate a failed renewal, and will go past due.

Please try that. Thanks.

January 03, 2012 05:53 pm
User photo
Michael Klett
Chargify Support

The original poster had everything correct, except for step 3 is to set the "Next Billing Date" to a few minutes away to force renewal (see http://docs.chargify.com/billing-dates).

Adding a charge is considered a one-time operation and doesn't affect recurring billing state.

January 05, 2012 02:40 pm