#bdanforth
1 messages · Page 1 of 1 (latest)
Hi there, can you share with me IDs of these two requests? Here's how you can find them: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Sure; the first request ID is in my OP: req_kXstuI1MdatTUj ; let me get you the second one
The second is req_clSSeVnoy5GO8j
Thanks, as the error message explains, the price that was specified in the request is inactive, and therefore the error.
Why does the same API call work if I use a different parameter to get the upcoming invoice for the same price?
Why can't I fetch an upcoming invoice for an inactive price? I can if I pass in the subscription ID instead.
Same price? I don't see you specify a price in the 2nd request
The subscription ID is for a subscription to that same price ID
sorry I don't really understand you
Perhaps you can tell me what problem that you are trying to solve, so that I can advise a solution accordingly
In both requests, I am trying to get the upcoming invoice for an archived price. The first request fails when I provide the price ID. The second request succeeds when I provide the subscription ID which is for a subscription to the archived price. I don't understand why the first request doesn't work.
OK, I assume that subscription already contains the archived price, am I right?
It's an active subscription to that price, yes.
And you just want to preview the upcoming invoice without any changes to the subscription?
Correct
Great. In this case, you just need to specify a subscription, not subcription_items[price]. You only specify subcription_items[price] if you want to preview the invoice after a subscription change as specified in the subcription_items[price]
In some contexts, I don't have a subscription ID (e.g. previewing a subscription that hasn't yet been created). I was hoping I could use the same API call with the same parameters both for to-be-created subscriptions and existing subscriptions, independent of whether the price is archived or not.
Ah I see, subscription_items is intended to update subscription_items on the invoice.
So when I call the API using subscription_items, it thinks I'm trying to change a subscription_item for an archived price, which is not allowed.
You are right
And you can't preview an upcoming invoice if you've not yet created a subsciption.
Okay thank you for clarifying why I see different behavior.
I think the docs could be more clear about that -- it's strongly implied after one reads the child parameters more carefully, but it's not explicitly mentioned for the description of the top level subscription_item parameter (https://stripe.com/docs/api/invoices/upcoming#upcoming_invoice-subscription_items), which only says: "A list of up to 20 subscription items, each with an attached price."
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Thanks for the feedback!