#bmizerany1234
1 messages ยท Page 1 of 1 (latest)
Hi ๐
Do you have a document you are following? Can you share some API request IDs? 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
I shared a request ID
req_7uptK2NWwNviv5
I'm not sure what document you are referring too.
The steps I took are above
DISREGARD. I'll open a new one.
with all of the request IDs and some extra info
Please keep everything in this thread
Subscribed a customer to a metered price with request ID: req_j8167xn0Xzhnbf.
Created a usage record for that price's subscription item as indicated in the subscription with request ID: req_fydWv8EspPUTfu.
Waited for over 10 minutes (actual time, no test clock was utilized).
Subscribed the customer to a different price with request ID: req_9CE6zeYs5Tq0Ap.
Created a usage record for the new price's subscription item within the same subscription using request ID: req_7uptK2NWwNviv5.
Quoting here for context
k
Don't mean to muddy things, just wanted to reformat that so we can easily read it as we go along:
- Subscribed a customer to a metered price with request ID:
req_j8167xn0Xzhnbf. - Created a usage record for that price's subscription item as indicated in the subscription with request ID:
req_fydWv8EspPUTfu. - Waited for over 10 minutes (actual time, no test clock was utilized).
- Subscribed the customer to a different price with request ID:
req_9CE6zeYs5Tq0Ap. - Created a usage record for the new price's subscription item within the same subscription using request ID:
req_7uptK2NWwNviv5.
And what is the behavior you expect after step 5?
I expect to see an invoice for the usage accumulated while subscribed to the price from step 1
I do see an upcoming invoice for the sub in step 3 and usage in 4.
It is if the sub and usage in 1 and 2 never happened.
You are putting a lot of prices in the intitial subscription. Can you try with just 1 so it's easier to track?
That's going to take awhile
I'll do that
however, it will not be representitive of what is happening in production
I'm waiting 10 minutes to change the subscription
You aren ot upadting the Subscirption directly, you are using a Subscription Schedule
In which case this whole approach is odd
I don't see it as odd. It's documented to be able to handle this
If you are using Subscription schedules why wouldn't you just create a new phase to represent the different items
Because you can only append so many phasens
I've ran into many problems with that approach
After much research, including discussions in here, updating the current phase was considered the correct approach
The documentation suggests it is also
You currently aren't passing in any proraiont_behavior parameter in your 4th request. https://dashboard.stripe.com/test/logs/req_9CE6zeYs5Tq0Ap
Is it intended that you want to create prorations?
Looking at the history of this Subscription I see the initial invoice being created and an invoice being generated
But no invoice after that
Okay. Same sequence using a single price: req_QFaiwaNbvP6Mvo, req_lCz9DLk5gx4Bqw, req_9PzgPWgc2p5uNr, req_ZMh78i6fsfJ6D4
No initial invoice
Yes there is. The first request resulted in this subscription sub_1NfWeuCmsTHMBvm3O8ZlnJNO which has a latest invoice of in_1NfWeuCmsTHMBvm3AoM2FZX8
Here is the event URL https://dashboard.stripe.com/test/events/evt_1NfWevCmsTHMBvm31yz8zjqc
GTN. Thank you. Is that showing up in the other screens? If so, where? I'm def missing something I think
Showing up == Invoice Shown
I'm not sure what screens you are referring to but the API returns the Susbcription Schedule with a subscrption proprety which is the ID for the underlying Subscription. That Subscription has a latest_invoice property which has the ID for that invoice
In the dashboard I mean
You seem to be using the CLI to create these. I would recommend you also use stripe listen to listen for webhook events related to these actions. https://stripe.com/docs/cli/listen
We're not super familiar with the Dashboard here since we are focused on the APIs but it shouldbe visible in the Subscription
Maybe I'm missing something but I don't see an invoice "finialized" here https://dashboard.stripe.com/acct_1NfVzZCmsTHMBvm3/test/events
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
or am I looking for the wrong thing?
I can't look at your dashboard, that link is useless to me
But the Invoice is in a draft status anyway so you wouldn't see it as finalized.
It's right there
The invoice is for $0
The usage is not accounted for
There was 10000 units reported to stripe for the first vesion of the sub
That invoice was created before you created any usage records
I see that
It was created as part of this request: https://dashboard.stripe.com/test/logs/req_QFaiwaNbvP6Mvo
however why is it not being updated with the usage reported during the time before I changed the subscription?
I see the update request too
The existing invoice will not be updated
That usage will show up on the next invoice
Where did the 10000 units of usage go?
It will be present on the next invoice
I report 10000, change the sub, then report 20000
Your report of the 10000 occurred after the initial invoice.
When you say you changed the sub, did you remove the prices associated with the earlier usage?
okay here is the real question I guess: Do prorations show up in the dashboard in invoices before the invoice is finalized? (I'm aware they show up in the API)
Once the invoice is created, new usage records and the charges they incur will show up on the next invoice.
And once again, I'm not certain about what the Dashboard will display as we are focused on the APIs on this server
I'm trying to follow and see where the usage is going
yeah okay. The dashboard not showing all the information is confusing as all heck. Thank you for your help. I'll look at prod to with the API to see if the prorations are there
Because I see you use the "sum" aggregation method
Each change to the sub starts a new billing period AFIK and so that means the first period/sub is sum(10000) and the next is sum(20000)
two diff invoices/bills/prorations
I expect the current invoice to show 20000 units, so that works as intended.
It's the previous usage records I can't find (in the dash)
hrm
THe issue I am seeing is that the subscription item the earlier usage record is associated with (si_OSRYA7dFvwSQ9G) is getting overwritten by the new one (si_OSRfLk98FyJMIA).
stripe invoices upcoming --stripe-account=acct_1NfVzZCmsTHMBvm3 \ --customer=cus_OSRX1agCqxdReD
But I don't see any usage record being written for the old Subscription item
Why is that?
In this request: https://dashboard.stripe.com/test/logs/req_9PzgPWgc2p5uNr you are overwriting the existing phases with the new ones.
Subscription Schedules don't merge their phases data (like Subscriptions do), the overwrite
Right, but that should behave the same as updating the current subscription directly, right?
that should behave the same as updating the current subscription directly
Nope, opposite
I badly want to drop one million F-bombs right now
I get that, I really do
That is not what I was told, and what I'm able to see in test mode
using test clocks
Test clocks shouldn't have anything to do with it
What I do I my code when updating subscription schedules is to extract the existing phases array, add my new items to the current phase so the items proprety has both, and then use that in my /update call
๐ Taking over this thread, catching up now
There is no ../update for sub schedules according to the docs https://stripe.com/docs/api/subscription_schedules/update
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
It's POST /v1/sub_sched/:id
hi @placid jetty welcome to the subscription schedule jungle
My code does the same. In this case, my "plan" prices are 100% diff than the previous so it amounts to a complete swap
I've seen in the past that subscription items kind of get "released" if we update a schedule to quickly (e.g. withing 5 minutes), but 3 months?
It seems something has changed on Stripe's end over the months.
I would not be surprised, it isn't the first time.
POST /v1/sub_sched/:id is the API to update the subscription schedule. Depending on the SDK you used, the function can be named as .update()
Can you summarise what your latest problem is?
I can:
I'm encountering an issue with Stripe. Here's the sequence of actions I took:
- Subscribed a customer to a metered price with request ID:
req_j8167xn0Xzhnbf. - Created a usage record for that price's subscription item as indicated in the subscription with request ID:
req_fydWv8EspPUTfu. - Waited for over 10 minutes (actual time, no test clock was utilized).
- Subscribed the customer to a different price with request ID:
req_9CE6zeYs5Tq0Ap. - Created a usage record for the new price's subscription item within the same subscription using request ID:
req_7uptK2NWwNviv5.
I now would expect to see an invoice or prorations applied to the next invoice for the initial usage of 10000 units, but I do not.
I'm creating and managing subscriptions via schedules in the API
When I change a subscription, I do so by updating the current phase in the schedule
That creates new sub_items for reporting usage with
I report usage using those si_ IDs
The first usage report in step 2 goes "missing" though
The second usage report in step 4 is in the upcoming invoice as expected, but the prorations for the initial 10000 are not
As mentioned by Snufkin that Subscription Schedule will overwrite the existing phase. It's either you add the new price to the phase 0 instead of replacing the old price; or create a new phase with new set of prices and end existing phase now.
Why don't you use Subscription directly, but Subscription Schedule? Subscription Schedule is meant to be used for future changes. The example requests here were all the immediate changes as of the time when the request was made.
We use this tool to experiment with pricing, and we use 2+ phases at times depending on customers. This tool should be general purpose and needs to accommodate those scenarios, and since subscription schedules are just another way to update subscriptions, we didn't want to design two paths for updating subscriptions
Why would not replace the item? It is not longer intended to be on the invoice and part of their phase.
So the answer here is: When the current phase of a schedule is updated such that a price, with associated usage, is removed from the items list, that prices usage is silently discarded.
Is that correct?
Yup, replacing the item will overwrite the price and usage in Subscription Schedule
Two options here: (1) Add new price as new item instead of replacing it; (2) End existing phase now and add a new phase with new set of prices
Dope. May I suggest calling out this behavior in the docs. We're loosing revenue over this
Thank you for you time @placid jetty and @tawdry raft
Thanks for sharing the feedback. We will forward to the team