#bdanforth

1 messages · Page 1 of 1 (latest)

tame hawkBOT
hallow jolt
zenith sonnet
#

Sure; the first request ID is in my OP: req_kXstuI1MdatTUj ; let me get you the second one

#

The second is req_clSSeVnoy5GO8j

hallow jolt
#

Thanks, as the error message explains, the price that was specified in the request is inactive, and therefore the error.

zenith sonnet
#

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.

hallow jolt
#

Same price? I don't see you specify a price in the 2nd request

zenith sonnet
#

The subscription ID is for a subscription to that same price ID

hallow jolt
#

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

zenith sonnet
#

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.

hallow jolt
#

OK, I assume that subscription already contains the archived price, am I right?

zenith sonnet
#

It's an active subscription to that price, yes.

hallow jolt
#

And you just want to preview the upcoming invoice without any changes to the subscription?

zenith sonnet
#

Correct

hallow jolt
#

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]

zenith sonnet
#

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.

hallow jolt
#

You are right

#

And you can't preview an upcoming invoice if you've not yet created a subsciption.

zenith sonnet
#

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."

hallow jolt
#

Thanks for the feedback!