#Vinz
1 messages · Page 1 of 1 (latest)
Hi there!
Hi soma, here is my case
I'm not sure I follow you question. Could you give a concrete example of what you are trying to achieve?
I have a subscription with :
- 2 A products/month
- 1 product B/month
- 0 product C/month
So I have a subscriptionItem of : - 2 products A/month (with stripe_ID)
- 1 product B/month (with stripe_ID)
- 0 product C/month (without stripe_ID)
The subscriber decides after a few days to switch to:
- 1 product A/month
- 5 products B/month
So he makes the modification :
Stripe schedules the downgrade to 1 product A/month for the next billing cycle → OK
Stripe launches a proration for product B → NOK
How to get the invoice price with proration and request user agreement for this particular invoice?
I use python
here is a bunch of code in my view:
if items_no_proration:
stripe.Subscription.modify(
self.subscription.stripe_id,
proration_behavior='none',
items=items_no_proration
)
if items_proration:
stripe.Subscription.modify(
self.subscription.stripe_id,
proration_behavior='always_invoice',
proration_date=int(time.time()),
items=items_proration
)
How to get the invoice price with proration
When do you want to get the invoice? Before the payment?
You want to show the user how much they will pay in the future after they updated their subscription or before?
ideally before updating subscription.
For the next billing anchor it is easy I do it in my backend. For proration, it's more tricky to display it on the front
Then you should use the upcoming invoice endpoint: https://stripe.com/docs/api/invoices/upcoming
And pass as parameters the subscription ID and all the changes you plan to make to the subscription