Schedule completed event is not supported by stripe

Viewed 134

I am using stripe schedules to handle the downgrade of the subscriptions. I need to test it, however, the events subscription_schedule.completed is not supported by stripe CLI(Even I upgraded to latest verison).

Theres no way on stripe dashboard to compelte the schedule before time.I need to do handle stuff on my backend after this event is triggered, what should I do?

1 Answers

subscription_schedule.completed events are sent when a Subscription Schedule transitions to having a status of completed. This happens when the Schedule has end_behavior: cancel and was allowed to end naturally by completing its last phase (not through an API call to cancel it).

You can trigger subscription_schedule.completed events yourself by updating or creating a new Subscription Schedule that ends a few seconds in the future and has end_behavior: cancel. Here's an example of how you would do this using curl (replacing FUTURE_TIMESTAMP with one that is a few seconds in the future, and using your own keys and object IDs):

curl https://api.stripe.com/v1/subscription_schedules \
  -u sk_test_XXX: \
  -d customer=cus_XXX \
  -d start_date=now \
  -d end_behavior=cancel \
  -d "phases[0][items][0][price]"=price_XXX \
  -d "phases[0][items][0][quantity]"=1 \
  -d "phases[0][end_date]"={{FUTURE_TIMESTAMP}}
Related