#Vinit_Churi
1 messages ยท Page 1 of 1 (latest)
๐ happy to help, please bear with me as it's a bit busy, I'll get to your question asap, sorry in advance
hello @ebon mortar could you please help me with my query?
I did figure out this parameters
"the customer id" &
"the customer subscription id"
what parameter do I need to pass for the api to know whatever plan the user wanting to switch to
there are a couple more params that you need to pass and some of them depend on the behavior you want
https://stripe.com/docs/api/invoices/upcoming#upcoming_invoice-subscription_items
subscription items represent the items you want to change in the subscription
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
https://stripe.com/docs/api/invoices/upcoming#upcoming_invoice-subscription_proration_behavior depending on how you want to deal with proration
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
and https://stripe.com/docs/api/invoices/upcoming#upcoming_invoice-subscription_proration_date in the case you want to simulate a proration at a specific date
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
in which parameter can I pass the plan id or plan price my user is intending to switch to
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I'm sending the price Id of the plan which the user want's to upgrade to and I'm getting this error
if you're using Postman I would suggest looking at our official Postman directory
as the error mentions, you need to change the param to subscription_items[0][price].
yes I'm using the offical stipe postman collection
I have made a fork of the collection
and what parameter should I enter
the price of plan?
not sure what you mean by that.
looks like the request you shared would work, if you fix that error.
ok let me try
please wait 2-3 min. till I test things, thanks for your patience
Now I'm getting this error
can you share the request ID req_xxx for that error? it's the in the HTTP response headers.
here sir
no, I mean please post the string req_xxx here(paste it here)
also your screenshot is the request headers. It's in the response headers. https://stripe.com/docs/api/request_ids
{{baseUrl}}/v1/invoices/upcoming?customer=cus_MTj6WrH66KsUve&subscription=sub_1LkleACy95Kg2yHQ78cIV4r4&subscription_items[0][price]=price_1L2vqOCy95Kg2yHQ0XUMrwcI
๐
found it sir here
req_pyqZUHxPpDXX9s
๐ ๐
you need to pass the id of the existing item that you're changing https://stripe.com/docs/api/invoices/upcoming#upcoming_invoice-subscription_items-id , basically.
in your case that's si_MTj6AVUVitPiHD I think.
existing plan id?
which param should I pass this into
subscription_items[0][id]
could you please wait 2-3 min till I try out changes
thanks you very much sir it's working, but what exactly is this subscription_items[0][id] and this id si_MTj6AVUVitPiHD that you mentiond
it's the ID of existing item on the subscription that you're updating
when you have a Subscription object, it has a list of items which are the various Prices attached to that Subscription. Each item has an ID https://stripe.com/docs/api/subscriptions/object#subscription_object-items-data-id
changing the Price on a subscription means, changing the Price on one of those items, so you need to pass the id of that item in the update call. https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#changing shows how that is done