#Dharunkumar Natarajan
1 messages · Page 1 of 1 (latest)
also, the total discount amount field shows as 0 in the invoice object:
"total_discount_amounts": [ { "amount": 0, "discount": "di_1N6fNtG3LDN6ekHVB6uqMQku" } ],
this is the invoice_id in_1N6fNtG3LDN6ekHVNmmSWEPf
Looking into this -- I see the one item price is $50 with 100% discount so not sure either
yeah, but since the subscription is prorated for the first month when they join, I was needing the prorated amount that stripe gives me to do some logic in my backend
so if the customer joins 15th of may, and the charge is $25 for the $50 subscription because of proration, I only give half the thing that I usually give
👋 I'm also take a look - catching up here
So giving some context - part of the issue here has to do with the way handles prorations where billing_cycle_anchor is set during Subscription creation. This generates a prorated line item, which are calculated by first applying the discount and THEN calculating the proration (so the proration line item itself hasn't actually been discounted)
I know this is a bit confusing
So is there any way to find the amount before discount?
If not, can I get an idea of how the prorated amount is calculated in stripe? So that I can use the same logic on my end to provide the same amount of quantity that stripe charges for
For this particular case the only way around that would be to look at the Checkout Session (which calculates the discount a bit differently, so it does show that the amount would be under amount_subtotal) https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-amount_subtotal
thanks, as the description of the field suggests, it will always show the total amount paid irrespective of if coupon applied or not right?
Yes, it should
thanks! will try this out!