#omnidk-error
1 messages ยท Page 1 of 1 (latest)
Hi Makoto, I hope you're well. I'll grab request id, here's the code;
$stripe->subscriptions->update(
$stripe_subscription_id,
['items' => [
'id' => $stripe_item_id,
'price' => $new_stripe_price_id,
]
]
);
request; req_OmphBihEbJfVFr
I can reproduce the same error, I have a feeling it is because the price of a subscription cannot be updated after it is active, due to complications such as prorations.
Please let me verify and come back to you.
okay, thank you
account owner is able to change the price of subscription that is active via stripe dashboard, figured it would also work via api.
Here is a doc that shows the changing of subscription price - https://stripe.com/docs/billing/subscriptions/upgrade-downgrade?
Thank you very much! You have just provided the solution in how to resolve this error ๐
Here's the flow, instead of updating the price id on the Subscription item directly, the current Subscription item is removed and replaced with a new one.
Let me write the code for you! I love coding, I am excited lol ๐ฅณ
Sorry about the wait, it seems the update is actually much easier than I thought
$stripe->subscriptionItems->update(
$stripe_subscription_item_id', // si_xyz'
['price' => $new_stripe_price_id]
);```
To update the price on an existing subscription, you can simply update the Subscription item associated with it, hope it helps! ๐
hey no worries, it's late and I wasn't sure if anyone on your end would be around. Thank you!
Glad I was able to help! Have fun coding! ๐
works perfectly, thank you so much! having fun, and I hope you get to code more soon! blessings!
Thank you!!! ๐