#maria795
1 messages · Page 1 of 1 (latest)
Then you are looking for https://stripe.com/docs/api/subscriptions/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.
I want to change a product that the customer purchases to a subscription, leaving all the billing information the same.
Sure, you update the Subscription items using the above endpoint. https://stripe.com/docs/api/subscriptions/update#update_subscription-items specifically
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 doesn't work for me passing another product id neither through that endpoint (https://stripe.com/docs/api/subscriptions/update) nor through https://stripe.com/docs/api/subscription_items/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.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
$subscriptionItems = $this->stripe->subscriptionItems->update(
$id, [
'plan' => ['product' => 'prod_MqHJjCuMXByLxl'],
'price' => ['product' => 'prod_MqHJjCuMXByLxl']
]
);
{
"success": false,
"error": {
"code": "You may only specify one of these parameters: plan, price.",
"message": "You may only specify one of these parameters: plan, price."
}
}
Have you taken a look at https://stripe.com/docs/billing/subscriptions/upgrade-downgrade?
There are some example code snippets there
But basically you need to retrieve the Subscription item ID
And set that as the items.id
You send the Price ID that is related to the Product that you want to change to
I'll try
Thank you! It worked!