#supreeth-subschedule-invoiceperiod
1 messages ยท Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- supreeth-bca-reset, 23 hours ago, 8 messages
Hi ๐
Can you share the corresponding request ID for these CURL requests? They will start with req_
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Here you go: req_tHaK9nOmyxDYnd
I think I deleted the subscription after that, if that matters
Okay so you are passing in a new start and end date for the first phase of the schedule? 2/9 - 3/1
yeah, but the start date is same as existing
I am trying to modify the end date to March 1
I'm confused, the current_phase property in the response to your API request shows an end_date value of 1709280000 or 3/1
yeah that should be correct
right ?
I want the current billing from 2/9 - 3/1 and then next from 3/1 to 4/1 and so on
but the invoice for 2/9 - 3/1 doesnt have correct period_start and period_end in root of invoice, but its correct for invoice line item
What is the related invoice? I'm not seeing that.
supreeth-subschedule-invoiceperiod
I might have to recreate it, maybe because I deleted the subscription
give me a few minutes, let me recreate
req_rukalukgG74mdy this is the new req ID
in_1Ohzt3E0InFu2MN0ANL3OqrA this is the new invoice ID
3/1 -4/1 is the interval shown in the invoice item
yeah correct, that is for the coming period
but the invoice's billing period is supposed to be 2/9 - 3/1 right ?
we cant rely on invoice item's period as well, as shows the next cycle's period
That's the latest invoice, which was created when the test clock was advanced
Previous to that I see 3 invoices with billing periods for 2/9 - 3/9 all with $0 amounts
yeah correct, this is the latest invoice
what we do is, when the invoice is created in draft, we then populate the invoice with line items based on the customer's usage, for this we rely on period_start and period_end of the invoice.
it works fine in normal cases, but with subscription schedule the period_start and period_end is getting set wrong
let me know if you need any more info from my side.
I'm seeing a subscription that is created on 2/9 with a montly recurring price so naturaly the billing cycle starts with 2/9 - 3/9. It looks like you are doing this through the dashboard so what you would want to do is set the Bill starting field to 3/1 and include the proration parameter. That will generate one invoice for 2/9 - 3/1 with a prorated charge
The monthly bill will then continue on the 1st of each month
how do we handle this for existing subscriptions ?
and generally the subscriptions are created from our backend service
๐ hopping in here since snufkin had to head out
Just to make sure I understand - your issue is specifically with in_1Ohzt3E0InFu2MN0ANL3OqrA and you expecting a different period on the invoice items, right? You were expecting the period to be 2/9-3/1 but it's 3/1-4/1?
my issue isnt specifically with in_1Ohzt3E0InFu2MN0ANL3OqrA
but in general on how to move an existing subscription to beginning of the month billing cycle
and yeah, suggestion from stripe was to use subscription schedules for that
while trying so, I noticed that the invoice period is not set correctly.
in case of in_1Ohzt3E0InFu2MN0ANL3OqrA, it should have been 2/9-3/1, but the period is set as 3/1 -3/1
Yeah I see what you mean - let me check on some things
sure
I'm checking on this with some other folks as well (Invoice period can be a bit tricky, so just want to be sure we're telling you the right thing)
@formal sorrel okay a few of us paired on this, and we think it's expected with the billing cycle anchor reset that it just has the "current time" as period start/end.
Definitely not what a few of us expected but we had never really tested that edge-case
I didnt understand, is this expected ?
If so, Is there any way to achieve what I want to ? To change the billing cycle and have correct period in the invoices
@formal sorrel we think it is expected. And that it's impossible to have the period you want in that case
@formal sorrel my colleagues exhasted all efforts to attempt to generate an invoice with the period you wanted. We were unsuccessful.
ohhh, Is that a bug in the system ? Because the invoice period is supposed to be correct right ?
No, as my colleague explained that is expected behavior. It is the intended outcome and not something that will be changed.
coming back to the initial question, what can I do from my side to handle this migration ?
You cannot achieve the outcome you want. That is what my colleague has already explained. In light of this you should consider testing out other options to see if they fit your use case
is it possible for you to suggest me other options ?
thanks in advance for looking into this, I really appreciate it.
is it possible for you to suggest me other options ?
Not really, that would be up to you and how you want to modify your customer subscriptions going forward.
๐
@formal sorrel unfortunately there won't be a way to do this or workaround it
Got it, thanks for looking to.
does this mean our current design of us relying on period_start and period_end to bill usages in not a recommended way ?
I don't fully understand what that could mean
we bill customers for their usage at the end of the month, monthly based on their usages. To achieve this, we rely on invoice.created webhook call during draft phase, and add all the invoice items, and after an hour it gets finalized.
to fetch the usage records, we use period_start and period_end of the invoice.
Gotcha, so yeah I would say that's incorrect. If I was building this I'd have "usage records" marked as pending (what hasn't been invoiced yet) and add that instead (and then mark them as billed). I wouldn't rely on the Invoice period.
Also important to know that when you call the Update Subscription API and pass billing_cycle_anchor: 'now' it immediately finalizes that Invoice, you can't just add things to it after (it's different with the SubscriptionSchedule API)
how to have items as pending ?
I don't know what that means again sorry.
that's impossible. Sorry the way you explained your use-case, I assumed it meant you tracked usage in your own database, is that not the case?
yeah thats correct, we track the usage is our database
we want to add them onto invoice
yeah so that's all I meant. Don't rely on the "period" since it's not really relevant. You, as the developer tracking usage, should know what has and hasn't been billed/invoiced yet.
oh got it
but its ok to add to the invoice as an item during draft phase right ?
Or do you recommend some other way ?
it's fine to do during draft if the Invoice is in draft. I was explaining there are cases where it wouldn't be.
ohh, how do we add to the invoice in those cases ?
You would add it before updating the Subscription
Or you switch to metered billing and report real usage as it happens: https://stripe.com/docs/billing/subscriptions/usage-based
the problem with metered billing is, there is a limit of 50 per invoice and we have different prices for each product
its a spot instances market and the price is never constant.
metered billing needs a price ID to report right ?
correct
yeah thats the reason we couldnt use metered billing from stripe
and had to resort to using our own database
yep that's fair so in that case you approach should work. And in cases where the Invoice gets finalized immediately you would add the pending InvoiceItem first and then make the call to the Update Subscription API
I thought we were supposed to use Update Subscription Schedule API
Update Subscription API and pass billing_cycle_anchor: 'now' should be run exactly at the end of the month to resync the billing cycle anchor ?
that's one way yes, or using the SubscriptionSchedule API that you were already doing right?
yeah,
so you are suggesting to just not rely on period from invoice at all?
whenever an usage record is pushed, mark it as recorded in our database ?
with SubscriptionSchedule API the invoice doesnt get finalized immediately right ?
correct (to both questions)
ok thanks
@formal sorrel anything else before I close?
that should be it