Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pausing a stripe subscription / extending the remaining period

Summary of what I am making

I am working on a platform that involves Stripe Connect and subscriptions. Basically I have connected accounts, that add their customers to the platform create price plans and then add subscriptions for their customers. The connected customers in turn have a fixed price monthly subscription to the platform.

My problem

I want to implement a feature where the customers of the connected account can pause their subscription. So for example if a customer pauses their subscription i would like to stop collecting as well as "holding" the remaining time of their subscription for when they un-pause. (For example I would like it if a customer starts a 6-month subscription, pauses at 4 months, and unpauses at 8 months that he would be billed again at 10 months.To be more specific the timeline is: He/she is billed at month 0, use the service for 4 months and pause, unpause after 4 months, use the service for 2 months and then get billed again.)

I have seen questions like this and the Stripe pause feature but it won't do what i want. I've also looked at articles like this but the solutions they offer don't really seem that "clean" to me. Is there an alternative/good practice that I am just not seeing.

like image 229
Markos Stamatakis Avatar asked Oct 20 '25 03:10

Markos Stamatakis


1 Answers

Honestly, I think any solution you come up with won't really be that "clean" since this use case isn't very well-supported with Stripe's current API.

The simplest solution I can think of is this:

  • Cancel the subscription when the customer wants to pause and set prorate:true (https://stripe.com/docs/api/subscriptions/cancel?lang=cli#cancel_subscription-prorate). This will create a proration line item for the unused time still left on the subscription.
  • When the customer wants to resume their subscription, create a new subscription using the same customer and price ID. The proration line item from the previous step will automatically be pulled in to the subscription (unless it was pulled into other invoices in the mean time).

Unfortunately, that solution doesn't solve your problem of wanting to not bill your customer immediately after they resume their subscription. If this is an important part of your flow you could try something like this:

  • Pause the subscription with pause_collection[behavior]:void https://stripe.com/docs/billing/subscriptions/pause#unable-provide-services
  • Calculate how much time is left on the user's subscription and store it (either in the subscription metadata or your own database)
  • When the user wants to resume, unpause the subscription with proration_behavior:none and add a free trial (by calculating and setting trial_end to the current timestamp + how much time is left from the previous step)
  • This will generate a $0 invoice right when the subscription is resumed, and then the user will be charged the full subscription price.
like image 145
karbi Avatar answered Oct 21 '25 17:10

karbi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!