#sargis-avetisyan_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1268486330497761303
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- sargis-avetisyan_api, 5 days ago, 38 messages
- sargis-avetisyan_api, 6 days ago, 22 messages
- sargis-avetisyan_api, 6 days ago, 24 messages
hi! what's the Invoice in_xxx that you think has wrong proration?
This is the invoice ID sub_1PiuFUB2BzF6ryro7ua1DfGl
sub_xxx is the subscription, it has multiple invoices, which one do you say has proration you don't expect?
in_1PiuL9B2BzF6ryroVSfOq9Ev the one for -2.32 ?
in_1PiuM7B2BzF6ryroIF3Y7XDa is the currnt period invoice amount was calculated wrong
it was calculated based on the unpaid in_1PiuJZB2BzF6ryroZKaLX5XX this subscription amount
ok I'm looking at in_1PiuM7B2BzF6ryroIF3Y7XDa. What specifically is wrong with it, what numbers/line items do you think it should have instead?
it should be 3$ instead of 0.68 and increased the unpaid invoice amount
it should be 3 + 2.32
what does " increased the unpaid invoice amount" mean? What amount is that in the API?
For in_1PiuM7B2BzF6ryroIF3Y7XDa it is $3 because it's the Invoice for the start of the new billing cycle, charging for the upcoming month on the curent plan(which is $3/month). Then the amount is reduced by 2.32 which is the customer's balance, which is the result of the previous invoice in_1PiuL9B2BzF6ryroVSfOq9Ev which was a negative invoice so it added to that balance. Hence the $0.68 total.
But the in_1PiuL9B2BzF6ryroVSfOq9Ev has not been paid by the customer yet, so how does the 2.32 become the customer's balance?
in_1PiuJZB2BzF6ryroZKaLX5XX this is the unpaid invoice, right?
in_1PiuL9B2BzF6ryroVSfOq9Ev has been 'paid'. It was a negative amount, which means there is no payment due and no payment method is charged and the total is added as a credit to the customer.
Let me explain again, please:
in_1PiuJZB2BzF6ryroZKaLX5XX is the unpaid invoice, right?
in_1PiuL9B2BzF6ryroVSfOq9Ev is the new invoice with a trial period of $0 and an unused time amount from the current period of $2.32. This amount is calculated based on the last unpaid invoice, in_1PiuJZB2BzF6ryroZKaLX5XX, which is $3 and is going to the customer balance for credit. But since the customer has not paid yet, how can they have a credit?
we calculate prorations on the assumption that the previous invoice will eventually be paid
But what happens if the previous invoice is not paid? We have a case in production where the previous invoice has not been paid.
it's just how it works. I understand your viewpoint that it's wrong, but it's just how we built this and it's not really configurable. If the invoice ends up not paid that doesn't really change anything, the proration was calculated assuming it would be. There's manual things you could do like editing the customer's balance, adding extra Invoice items to cancel out the proration, disabling proration with proration_behavior:"none" when making updates, and so on.
OK, Thanks
Can you explain to me how it works proration_behavior:"always_invoice" ?
https://docs.stripe.com/billing/subscriptions/upgrade-downgrade#immediate-payment
To bill a customer immediately for a change to a subscription on the same billing cycle, set proration_behavior to always_invoice. This calculates the proration, then immediately generates an invoice after making the switch.
I will check it, thank you
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
I only want to know if there is a way to calculate prorations based on whether the previous invoice is paid or not paid?
prorations don't work this way unfortunately
I mean the next invoice won't add the payment from the previous "unpaid" invoice
sorry I'm going back and reading the whole thread to get more context
I think the best option for you here is to check the status of the subscription's latest_invoice before creating any update on the subscription itself