Reputation: 15
In Stripe, I have multiple customers with multiple subscriptions each. I want to convert these multiple subscriptions into a single subscription with multiple items so that my customers are only charged once per month.
Currently, I am able to add new items to each subscription, but I can't figure out how to get the right billing behavior.
Desired Flow:
User has existing subscription that bills on the 1st for $20 >> User adds new item to subscription on 15th for $10 >> Stripe charges them $10 for this month >> Stripe charges them $30 on on the 15th moving forward
Currently, I am able to either:
1. Prorate the new subscription so they are charges $5 on the 15th and $30 on the 1st moving forward (not paying the full amount for the month starting now)
2. Reset the billing cycle so they are charged $30 on the 15th (double charging them for the existing subscription which was already paid on the 1st)
Is there a better way to handle this?
Upvotes: 1
Views: 1079
Reputation: 437
- Reset the billing cycle so they are charged $30 on the 15th (double charging them for the existing subscription which was already paid on the 1st)
This solution is on the right path, but you need to make sure to create prorations and reset the billing cycle anchor. Creating prorations will make sure that your customer is issued a credit for the unused time on the $20 Subscription Item, and setting the billing cycle anchor to now
(e.g. the 15th) will ensure that the $10 Subscription Item can be charged in full.
The Subscription Update API call would look something like this (if you're using Python):
stripe.Subscription.modify(
"sub_abc123",
proration_behavior='always_invoice',
items = [{
"price": 'price_abc123'
}],
billing_cycle_anchor= 'now',
)
In the above block, the new $10 Price would be price_abc123
. The proration_behavior
parameter is set to always_invoice
, so that the update will immediately create a proration item (e.g. a credit for the unused time) on the original $20 Price.
The result should be a payment on the 15th of roughly $10 (new item) + $20 (next charge on original item) - $10 (proration credit for unused time on last month's time) = $20
Upvotes: 0