#ThisIsJustin

1 messages · Page 1 of 1 (latest)

mint oliveBOT
spice violet
#

Otherwise, there are a lot of different ways to do this. You can set up and cancel subscriptions through the dashboard or via the API. We have test cards to succeed or fail various payments in certain ways https://stripe.com/docs/testing

#

Can you tell me more about what you are trying to test?

cursive jasper
#

I did use a test clock to show reoccurring monthly billing is working. How do I have it cancel a subscription for a customer for instance?

#

Ok let me trying to explain better...

#

I have a payments link that is setting up reoccurring monthly subscriptions. I have a webhook listening for those successful events. That works fine. I have also set up webhook events to handle when a customer ends/cancels their subscription (it is listening for ustomer.subscription.updated events). I just want to know the best way to test when a customer takes that action. I think I just want a way to fire those kinds of events on behalf of my fake test customers to make sure my backend systems handles it properly.

spice violet
#

Do you know how your actual customers will be cancelling their subscriptions? Will you be using our Customer Portal or will this be a custom page of yours where you make the cancel API call?

cursive jasper
#

customer portal to start

spice violet
#

In that case you can create a customer portal session with the test clock customer's ID and click the cancel button from there.

#

Or can update the subscription with cancel_at set to later and advance the test clock.

#

You can provide the subscription/customer ID like normal and they will display the proper behavior for what it would look like if you made that call at the time that the clock is set to

#

Or am I missing the question a bit? Are you already doing this kind of thing and aren't getting events or something?

cursive jasper
#

No, you are helping for sure.

#

This is what I needed

#

Will try each of them now.

#

Yep I see the end date as I set up the sub in a test clock. That should help me test.

#

Thanks for the help. You guys rock!

#

Can you confirm for me what the correct event will be if a customer, using the customer portal, ends or pauses their subscription?

spice violet
#

The event for ending the subscription depends on your customer portal's cancelation method. If you have it set to cancel immediately, you will get a customer.subscription.deleted event right away. If you have it to set at the period end, you will get a customer.subscription.updated event where canceled_at is updated on the subscription and then will get a customer.subscription.deleted event when the subscription is actually cancelled

cursive jasper
#

So is it fair to say the updated event is a bit of an early warning? The deleted event is when the customer is no longer paying and their “paid for time” is up?

narrow ether
#

The updated event will fire whenever the Subscription's status transitions. The deleted event will fire when the Subscription is canceled