Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set end date when setting up Stripe subscription

In my application users are subscribed (and billed) each month for 24 months. Is there any way to have Stripe automatically end the subscription after the 24th month when I initially create the subscription?

like image 785
Tyler McGinnis Avatar asked Aug 05 '14 02:08

Tyler McGinnis


1 Answers

What you describe is possible in Stripe, but not as an out-of-the-box solution (as of August 2014). You'll need a little bit of programming logic on your end, too.

First, you'll need to have a web hooks endpoint:

https://stripe.com/docs/webhooks

Next, you'll want to subscribe the customer to a plan like normal. We'll notify your site, via the web hooks, of when payments are made on a recurring subscription. Specifically, you'll want to watch for invoice.payment_succeeded events:

https://stripe.com/docs/api#event_types

Once a specific customer has hit the right number of payments (which you'll track on your end), you'd then issue a cancel subscription request:

https://stripe.com/docs/api#cancel_subscription

Hope that helps! Larry

PS I work on Support at Stripe.

like image 166
Larry Ullman Avatar answered Sep 22 '22 22:09

Larry Ullman