mardi 30 janvier 2018

Change subscription interval for subscription with multiple subscription items in Stripe

I'm using Stripe (PHP Client, Laravel) to handle our subscriptions. We both have subscription and addons which Stripe doesn't seem to support nativly - however I've found a workaround but I encounter a problem.

Set up
We have some different subscription available to our users.

Monthly:

  • 1 Entity ($10/month)
  • 5 Entities ($40/month)
  • 10 Entities ($80/month)

Yearly:

  • 1 Entity ($100/year)
  • 5 Entities ($400/year)
  • 10 Entities ($800/year)

Addons:

  • 1 Entity ($10/month)
  • 1 Entity ($100/year)

Imagine a user is subscribed to a monthly 5 entities plan ($40/month) with 2 extra addons a month ($20/month). Total of $60/month.

The addons are added as SubscriptionItem using Stripe's PHP Client Library.

How would I go about upgrading the user to a yearly subscription like this:

  • 1x 5 Entities ($400/year) subscription
  • 2x 1 Entity ($200/year) addons

As you can see, the only difference is the billing interval and the price but the same access to our system.

I've tried to just upgrade the subscription plan (not the addon) but I got an error which seems logical due to the different billing intervals.

Would I have to remove all of the subscription addons (SubscriptionItems), then make the upgrade and when add the subscription addons again with their new billing interval? I don't like this approach since I would have to delete the initial subscription and then no where to return the user incase the charge fails...

Another way would be to create a entirely new subscription with the addons seperat from the initial. Then I could assign the new subscription to the customer and remove the old subscription.

All of this seems a bit weird since Stripe is so easy and flexible. I might me missing something? Am I?

What is the best way for me to switch between monthly and yearly plans when I have other subscription items in the subscription?

Hope you understand my question. Thanks!



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2GyBzUP
via IFTTT

Aucun commentaire:

Enregistrer un commentaire