#.buddhaha
1 messages · Page 1 of 1 (latest)
Hi, let me help you with this.
Could you please provide an example where it's different?
My own calculated proratio amount in 1st pic, Stripe calculated proratio amount in 2nd pic
I believe there needs to be a single source of truth. How are you calculating this?
Could you just take the value from the Invoice?
Okay, so I have tried using stripe.invoices.retrieveUpcoming now instead, to retrieve from the invoice
but it doesn't seem like I can get the amount due before next billing date of the subscription cycle, if that makes sense?
like the proratio
What are you getting instead?
The full amount for the next billing cycle I suppose
The updated lineitem in the invoice looks like this ```{
id: 'il_tmp_177c35KD1uSVDE8Hbe356804',
object: 'line_item',
amount: 554183,
amount_excluding_tax: 554183,
currency: 'sek',
description: 'Remaining time on 4 × Extra seats - new after 24 Oct 2023',
discount_amounts: [],
discountable: false,
discounts: [],
invoice_item: 'ii_1O4gWwKD1uSVDE8H0SussTlL',
livemode: false,
metadata: {},
period: { end: 1720044000, start: 1698138246 },
plan: {
id: 'price_1O0g6wKD1uSVDE8HZTXEaLsf',
object: 'plan',
active: true,
aggregate_usage: null,
amount: 200000,
amount_decimal: '200000',
billing_scheme: 'per_unit',
created: 1697183322,
currency: 'sek',
interval: 'year',
interval_count: 1,
livemode: false,
metadata: {},
nickname: null,
product: 'prod_OoIiHa2fBtGF05',
tiers_mode: null,
transform_usage: null,
trial_period_days: null,
usage_type: 'licensed'
},
price: {
id: 'price_1O0g6wKD1uSVDE8HZTXEaLsf',
object: 'price',
active: true,
billing_scheme: 'per_unit',
created: 1697183322,
currency: 'sek',
custom_unit_amount: null,
livemode: false,
lookup_key: null,
metadata: {},
nickname: null,
product: 'prod_OoIiHa2fBtGF05',
recurring: [Object],
tax_behavior: 'exclusive',
tiers_mode: null,
transform_quantity: null,
type: 'recurring',
unit_amount: 200000,
unit_amount_decimal: '200000'
},
proration: true,
proration_details: { credited_items: null },
quantity: 4,
subscription: 'sub_1O4fDtKD1uSVDE8HMqsglA5C',
subscription_item: 'si_OsQOoiezpcrQ7a',
tax_amounts: [ [Object] ],
tax_rates: [],
type: 'invoiceitem',
unit_amount_excluding_tax: '138546'
}
That's just one line from the Invoice.
yeah to be clear that is part of the proration. The way proration works in Stripe by default is
- you have a subscription that is from 1 Oct -> 1 Nov for $100
- on Oct 20 you change to a plan that is $200
- we generate two prorations
- a charge for 10 days of $200
- a refund for 10 days of $100
- on 1 Nov, the Invoice(and if you use retrieveUpcoming this is what you are previewing) has three line items, the charge, the refund, and the $200 for the upcoming Nov 1 -> Dec 1.
see also
https://stripe.com/docs/billing/subscriptions/prorations
and perhaps also specifically in your case https://stripe.com/docs/billing/subscriptions/prorations#:~:text=You can use,the same time.