#sskarim - invoice

1 messages · Page 1 of 1 (latest)

storm root
#

Hi there!

#

Can you clarify your question?

lusty perch
#

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

storm root
#

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).

lusty perch
#

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

desert flume
#

Which sub_xxx is that from?

lusty perch
desert flume
#

That subscription isn't cancelled?

lusty perch
#

yes, because i subscribed him again to basic plan

#

the one he already paid for

desert flume
#

Ok, and what is the expectation here?

lusty perch
#

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

desert flume
#

And credited to the customer

#

Does that make sense?

lusty perch
desert flume
#

As noted by my colleague, we assume that every invoice will be paid regardless of subscription status

lusty perch
#

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 ?

desert flume
#

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)

lusty perch
#

intressting , i'll test that , 5 sec will be enough ?

desert flume
#

Maybe, can you share the code that makes these API calls?

lusty perch
#

sure

desert flume
#

Looks like those calls are made synchronously?

#

You should probably await a response from the void_invoice call before deletion

lusty perch
#

i did that, and added a delay of 20 secs, but same things, i guess stripe in including voided invoices when calculating proration

desert flume
#

Why do you need to pass prorate: true?

lusty perch
#

so customer get credit for his valid subscription ( unsed time in his first subscription basic plan ) before he try to upgrade to premium one

desert flume
#

I suspect that the invoice status is not taken into account at all really, and simply the unused time on the subscription is prorated

lost sparrow
#

Hey, taking over here. Let me know if there's any follow-up Qs I can answer!

lusty perch
#

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 ...

lost sparrow