#abhinav_best-practices
1 messages ยท Page 1 of 1 (latest)
๐ 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.
๐ 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?
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.
yes but you already collected the previous month
subscription (with the exception of metered prices) are prepaid
No, the collection was only done when subscription was created i.e. for the first item for $20. That's the behavior I see.
yes which is the first month
in your calculation the customer is paying twice for the first month
No, he has paid just $20 in the first month.
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.
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
Are you saying that the billing period changes after upgrading a subscription quantity
We don't want to change it.
and you want to apply the quantity 2 to the subscription on July 1st?
Yes. I am testing the upcoming invioce API and I think I have got it.
I just need to change the prorationDate to currentPeriodStart
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
But this extra charge of $20 is only for the next invoice. After that, the invoices should only contain $ 40 for 2 quantity.
I will take a look.
what I'm not understanding is why you want the extra charge since the customer has already paid you 20$
for the first period
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.
but you said you don't want to give access in June for the second product?
I never said that.
so you want the second quantity to be paid but in the next billing cycle right?
Correct, Sir.
in that case when upgrading using https://docs.stripe.com/billing/subscriptions/subscription-schedules/use-cases#upgrading-subscriptions you need to pass a add_invoice_item to your phase https://docs.stripe.com/api/subscription_schedules/create#create_subscription_schedule-phases-add_invoice_items which only applies to the current invoice
Can I add a recurring type price id in there?
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
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
hi! I'm taking over this thread.
I'm not sur I understand the question. you can see the upcoming invoice in the Stripe dashboard or using the API: https://docs.stripe.com/api/invoices/upcoming
I am trying the API mentioned on https://docs.stripe.com/billing/subscriptions/prorations#preview-proration. It generates a json response with a field called url.
how can I view the invoice in the browser using this URL??
I don't think an upcoming invoice would have an url.