#abhinav_best-practices

1 messages ยท Page 1 of 1 (latest)

rocky wigeonBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1252585133123309588

๐Ÿ“ Have more to share? Add details, code, screenshots, videos, etc. below.

clever crypt
#

๐Ÿ‘‹ happy to help

#

So the upcoming bill should have original charges + new charge for next month + charge for the previous month (without proration)
why do you want to double bill the current period?

whole hemlock
#

Let's say the charge is $ 20. The original subscription was for quantity 1 and the total cost is #20. Start date = June 1.

Now, on June 18, the customer subscribes for one more quantity. We want the upcoming invoice to look like.

Subscription for 2 products = $ 40
Previous Month usage = $ 20

Total = $ 60

So, we want to charge the customer the full amount of $ 20 for June, even though he subscribed on June 18.

clever crypt
#

yes but you already collected the previous month

#

subscription (with the exception of metered prices) are prepaid

whole hemlock
#

No, the collection was only done when subscription was created i.e. for the first item for $20. That's the behavior I see.

clever crypt
#

yes which is the first month

#

in your calculation the customer is paying twice for the first month

whole hemlock
#

No, he has paid just $20 in the first month.

clever crypt
#

ok and now they should only pay for 40

#

why do they need to pay again the 20?

whole hemlock
#

Because they paid only $20 for the first product during subscription creation.

#

For the second product by default prorations are applied and added in the upcoming invoice. We just need to change the prorated amount to the full amount.

clever crypt
#

that's not how proration work

#

you're missing the whole point of upgrading a subscription quantity

#

they're not adding 2 extra items they're just adding one extra

#

so basically they paid for the period of June 1st to June 18th = 20$
from June 18th to July 17th they need to pay 40$ because the new quantity is 2

whole hemlock
#

Are you saying that the billing period changes after upgrading a subscription quantity

clever crypt
#

normally it does

#

do you want it to change at the end of the current period?

whole hemlock
#

We don't want to change it.

clever crypt
#

and you want to apply the quantity 2 to the subscription on July 1st?

whole hemlock
#

Yes. I am testing the upcoming invioce API and I think I have got it.

#

I just need to change the prorationDate to currentPeriodStart

clever crypt
#

that's not how you should do it sorry

#

if you want the change to apply on the next period you should use subscription schedules

whole hemlock
#

But this extra charge of $20 is only for the next invoice. After that, the invoices should only contain $ 40 for 2 quantity.

clever crypt
#

what I'm not understanding is why you want the extra charge since the customer has already paid you 20$

#

for the first period

whole hemlock
#

The first period is June 1 to June 31. The customer paid $20 on June 1 for quantity 1.

On June 18, the quantity becomes 2. The customer doesn't pay anything.

On July 1, the invoice of $40 is paid for July's usage.

The charge for the second product for June month is never paid.

clever crypt
#

but you said you don't want to give access in June for the second product?

whole hemlock
#

I never said that.

clever crypt
#

so you want the second quantity to be paid but in the next billing cycle right?

whole hemlock
#

Correct, Sir.

clever crypt
#

Learn how to use subscription schedules.

whole hemlock
#

Can I add a recurring type price id in there?

clever crypt
#

no it needs to be a one-off price

#

or you can actually set the quantity to 3

#

and then in the next phase set it to 2

#

so it's really up to you

whole hemlock
#

Can you also tell me how can I view the invoice in the browser using the URL generated by upcoming invoice. E.g. /v1/invoices/upcoming/lines?subscription\u003dsub_1PRa0kBZuRENdfSA3JZg9DEh\u0026subscription_proration_date\u003d1720963066\u0026subscription_items%5B0%5D%5Bquantity%5D\u003d3\u0026subscription_items%5B0%5D%5Bid%5D\u003dsi_QIALSg7tQFbTnA\u0026customer\u003dcus_QIAKDagBjI2kW4

waxen ocean
#

hi! I'm taking over this thread.

whole hemlock
#

how can I view the invoice in the browser using this URL??

waxen ocean
#

I don't think an upcoming invoice would have an url.

rocky wigeonBOT