#pavan-upcoming-invoice

1 messages · Page 1 of 1 (latest)

plucky ridge
#

what's the specific issue you're having?

#

/ what does your code to call the upcoming invoices api look like so far?

topaz quest
#

There is one subscription and 2 products in it. It is yearly subscription. Suppose 1 product quantity increased by some units. How to calculate due for that product and also total due.

plucky ridge
#

that api endpoint will return what the invoice will look like on the next billing cycle (depending on what other params you pass to the upcoming invoice endpoint, that cycle might be now)

topaz quest
#

But in the response i got 3 line items for 1 product. Those are mentioned in screenshot

#

With 3 different descriptions.

plucky ridge
#

right - those are prorations for the used / unused time

#

I guess, first of all - do you want to be prorating subscription quantity updates by time of use?

topaz quest
#

Yes, proration amount that needs to be paid should be retrieved

plucky ridge
#

those will show up as separate line items

#

there's a negative line item crediting the customer for the unused time on the old quantity, a positive line item for the remaining time on the new quantity, and a 3rd line item for the next billing period on the new quantity

topaz quest
#

I am using subscription_proration_behavior=Always_invoice.

#

Are you guys also provide call support ?

plucky ridge
#

not in this discord

#

do you have a sample request ID for one of the upcoming invoice requests you're making?

topaz quest
#

/v1/invoices/upcoming/lines?subscription\u003dsub_1JgmOVCuLjRTHyU30k13mo8w

#

is this the one ?

plucky ridge
#

you're not passing any subscription_proration_behavior in that call

topaz quest
#

Thanks.

#

What does this 2 items represent

#

and also amount definitely seems wrong

#

In a year for 100 endpoints it should be 120 * 100 = 12000

#

Why it is showing more than that ?

#

Total due should be 5396

#

It is coming when we add both and divided by 100

plucky ridge
#

what this models is eg: I sign up for 50 endpoints on jan 1

#

I upgrade to 100 endpoints on oct 1 (let's say this is exactly 75% of the way through the year, to keep the math simple)

#

at that point, I receive a credit for 120 * 50 * 0.25, and an additional line item for 120 * 100 * 0.25

#

because I should be paying for 100 endpoints from oct 1 through dec 31

#

however, if you don't specify anything for subscription_proration_behavior, I'm not charged anything on oct 1

#

on my next bill, I'll see 3 line items

#

the two proration items described above

#

and then also an item for 100 endpoints from jan 1 to dec 31 of the following year

#

so my bill the first year is 120 * 50 = $6000, as though I'd only used 50 endpoints for the entire year

#

then on the 2nd year, I pay 120 * 100 + 120 * 100 * 0.25 - 120 * 50 * 0.25 = $13500

#

which is the full bill for the 2nd year, plus the extra for the upgrade that I did partway through the first year