#happycathode
1 messages · Page 1 of 1 (latest)
it's like ending_balance doesn't take in account the amount_due, but the total instead
Hello! Let me look into this, hang on...
Can you share the Invoice ID after you apply this change and see the expected ending_balance?
What we're seeing looks expected based on what you shared. The total Invoice amount is 2349 which uses all of the Customer balance (-1910) bringing it to zero and leaving 439 to be paid (the amount_due).
doing the subscription upgrade (from 16$/month to 20$/month) produced this invoice in_1NTowqJhU1jdykbLcdtfGdGb
it took 3.48$ from balance
customer is cus_NzGBzK7RVixVDN, if you want to see full history, that's my test customer I'm trying to figure this out
note that there might be some penny differences, I applied the upgrade maybe 30-45 minutes after I generated the upcoming invoice
I'm a bit confused now. You say it's expected behavior, but the upcoming invoice information doesn't match reality. The upcoming invoice says that the customer balance will be "0" when the invoice is finalize, but it's currently 15.62$
just did another test
upcoming invoice : req_xF8kagv0yAf4Hs
{
"object": "invoice",
"amount_due": 1373,
"amount_paid": 0,
"amount_remaining": 1373,
"billing_reason": "upcoming",
"collection_method": "charge_automatically",
"created": 1691684608,
"currency": "cad",
"custom_fields": null,
"customer": "cus_NzGBzK7RVixVDN",
"ending_balance": 0,
"livemode": false,
"next_payment_attempt": 1691688208,
"period_end": 1691684608,
"period_start": 1689006208,
"starting_balance": -1562,
"subscription": "sub_1NRiMOJhU1jdykbLQ1fxgt85",
"subscription_proration_date": 1689354203,
"subtotal": 2935,
"subtotal_excluding_tax": 2935,
"total": 2935,
"total_discount_amounts": [],
"total_excluding_tax": 2935,
}
subscription update : req_Ts9iILqkHVVq7n
generated invoice : in_1NTpPiJhU1jdykbLOqHBIkc4
the upcoming invoice req_xF8kagv0yAf4Hs and actual invoice in_1NTpPiJhU1jdykbLOqHBIkc4 are vastly different
The total amount of the Invoices (upcoming vs. actual) are very different.
Do you know why that is?
Maybe something to do with the always_invoice difference between upcoming and actual update?
both are done with the exact same price, price_1NFpULJhU1jdykbLgrQY1IpG, I don't know why it's different :/
hmm
Can you try setting proration_behavior to the exact same thing?
that was exactly the problem ! Added subscription_proration_behavior = 'always_invoice', to upcoming invoices, and now ending_balance matches exactly reality -.-
thank you so much
forgit I've set the upgrades to always_invoice -.-
Hi karbi, this is resolved, the issue was I wasn't previewing invoices with the same proration_behavior than the actual subscription changes