#sskarim - invoice
1 messages · Page 1 of 1 (latest)
a customer is already subcribed to basic plan (29€/month), he clicks to upgrade to the premium plan (49€/month), but the payment fails or he didn't even finish the process ...., so here we cancel the subscription with proration=true , and void the upaid invoice , here if we subscribe the customer to his old plan (Basic one) , he will get 20€ credit in his balance , 20€ is the amount of the voided invoice (the amount of cancled payment intent )
i can reproduce it right now and give you cus_... , sub_... ids
i can reproduce it right now and give you cus... , sub... ids
Yes please share the relevant IDs.
However note that we calculate prorations under the assumption that the previous Invoice will eventually be paid (even if the latest Invoice has been voided).
how can i change that , since payment failed
cus_MNNI0eWUNctL1w customer id
here you can notice that customer has 2 payment , the first successed the second failed
in_1LecZxDXuPWWFhCpjHGNRaiP if i void this invoice and cancel the subscription with proration = true , no credit will be add to customer balance ( and according to docs it should )
here payment intent is canceled after invoice was voided , but no credit were added to customer balance
so how comes that if i subscribe the customer to his old plan the one he already paid for , the amount of the canceld payment will be added to as a credit to his balance
Which sub_xxx is that from?
sub_1LeckWDXuPWWFhCpMWjDYDpL
That subscription isn't cancelled?
Ok, and what is the expectation here?
customer should not have 23.19€ in his balance
coz he is subscribed to his first plan , but still have 23.19 € as a credit in his balance , so it's like he earned 23.19€
take a look here , customer has one succeeded payment 34.68€, and it's the amount for a monthely subs ( basic plan ) , why should he have another 23€ in his balance
It's because you cancelled this sub: sub_1LecXRDXuPWWFhCplbCpDd8m
And passed prorate: true: https://dashboard.stripe.com/test/logs/req_UvIOMsalN2b1SZ
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Therefore we calculated unused time on this Invoice: https://dashboard.stripe.com/test/invoices/in_1LecZxDXuPWWFhCpjHGNRaiP
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
And credited to the customer
Does that make sense?
not for me since the invoice was never paid, and voided, why would you credit a customer amount he never paid , is there a way i can other than voiding invoice to avoid crediting a customer amount he didn't pay in the first place
As noted by my colleague, we assume that every invoice will be paid regardless of subscription status
the problem here is not subscription status, it's invioce status (voided) , it will be make more sens to not include voided invoice in the proration , but since it's like that , my question is can change this behavoir or not ?
Well a voided invoice shouldn't be considered in proration calculations as they're considered zero-value
So I suspect this is a race condition (you seemingly void the invoice ~1 second before cancelling the sub)
intressting , i'll test that , 5 sec will be enough ?
Maybe, can you share the code that makes these API calls?
Looks like those calls are made synchronously?
You should probably await a response from the void_invoice call before deletion
i did that, and added a delay of 20 secs, but same things, i guess stripe in including voided invoices when calculating proration
Why do you need to pass prorate: true?
so customer get credit for his valid subscription ( unsed time in his first subscription basic plan ) before he try to upgrade to premium one
I suspect that the invoice status is not taken into account at all really, and simply the unused time on the subscription is prorated
You can adjust the customer balance manually: https://stripe.com/docs/billing/customer/balance#modifying
Hey, taking over here. Let me know if there's any follow-up Qs I can answer!
yeah , the question is , does stripe include voided invoice when calculating proration ?
for me it's the case , and it does not make sens , since voided invoice are zero value ...
The invoice status is ignored while, we juste prorate according to subscription unused time