#ijsje
1 messages · Page 1 of 1 (latest)
Hi there
Hello, do I need to calculate the totals of everything that is due now myself?
So to clarify, you only want to show the amount associated with the update
Or you want the pending invoice items as well?
I want to show the customer the amount associated with the update. So in this example 02 mrt 2023
I can get it from the api call as shown in the pic, but I still need to calculate the totals myself it looks like
I was wondering if maybe I used the upcoming invoice api wrong.
upcoming_invoice = stripe.Invoice.upcoming( customer=subscription_obj.stripe_id, subscription=subscription_obj.subscription, subscription_items=items, subscription_proration_date=int(time.time()) )
Oh okay so you want to show as if you are going to invoice right now
Not for the next cycle?
If so then you want to set proration_behavior: 'always_invoice': https://stripe.com/docs/api/invoices/upcoming#upcoming_invoice-subscription_proration_behavior
Yes, because when the customer clicks on update, I am invoicing the proration immediatly
Then yeah the above should do the trick
I have that
Ok so there is nothing more I could do from the upcoming invoice api. Yes everything works fine.
response = stripe.Subscription.modify( subscription_obj.subscription, items=items, proration_behavior='always_invoice', payment_behavior='allow_incomplete', )
This is my code when a customer clicks on "Upgrade"
The "problem" is that the upcoming invoice acts like always invoice doesn't exist. So I get the data as shown in the picture above.
the total tax and total amount are for april 2nd, not for right now.
I'm talking about adding proration_behavior: 'always_invoice' to the upcoming Invoice API
I am purely talking what I show to the customer. The actual subscription modification works perfectly.
oh!
I understand
See the link to the API Ref I shared above
We support that parameter in the upcoming invoice API as well
Oh thankyou! Stupid of me. I was reading this documentation:
https://stripe.com/docs/billing/subscriptions/prorations#preview-proration
It's fixed now