#rzzz | Real Deal
1 messages · Page 1 of 1 (latest)
Hello! How can I help?
We are trying to integrate stripe to our website. We want to know the behavior when it comes to upgrade and downgrade of subscription. Been following the documentation https://stripe.com/docs/billing/subscriptions/upgrade-downgrade but got confused along the way 😂
which api endpoint should we use and what parameters do we need.
and also is it possible to refund directly to the credit card if the customer downgrade's the subscription
Well let's start at the beginning - what proration behavior do you actually want to see? Do you want customers to be charged immediately for changes when they upgrade/downgrade? Do you want them to be not charged at all? Do you want them to be charged on the next billing cycle?
We want the customers to be charged immediately
Gotcha - then for all updates you'd set proration_behavior: always_invoice
does stripe automatically carry over the proration_behavior to the next invoice?
No, you need to set it everytime you make an update
for example the plan premium is work $89 and he wants to downgrade to a lower plan which is starter and cost $59 and he want's to update the subscription immediately. And he already paid for the premium and it's only half a month using the premium subscription then he downgrades to the starter plan.
Remaining time on Premium plan = 15 days / 30 days = 0.5
Value of remaining time on Premium plan = 0.5 * $89 = $44.50
Cost of Starter plan for remaining time = 0.5 * $59 = $29.50
Prorated amount = $29.50 - $44.50 = -$15.00
how to accomplish this using stripe api
That's what we automatically do when you change the price on the subscription and use proration_behavior: always_invoice
You can look at the example at https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#changing for how to change the price, and instead of create_prorations you'd use always_invoice
will check this for now. Thank you