#omnidk-error

1 messages ยท Page 1 of 1 (latest)

heavy gust
#

Hi there, is there a request id I could take a look please?

snow oxide
#

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

heavy gust
#

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.

snow oxide
#

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.

heavy gust
#

Thank you very much! You have just provided the solution in how to resolve this error ๐Ÿ˜

snow oxide
#

really?! yay!!

#

haha

heavy gust
#

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 ๐Ÿฅณ

snow oxide
#

fantastic! I'd sure appreciate that!!

#

I love coding too ๐Ÿ™‚

heavy gust
#

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! ๐Ÿ™‚

snow oxide
#

hey no worries, it's late and I wasn't sure if anyone on your end would be around. Thank you!

heavy gust
#

Glad I was able to help! Have fun coding! ๐Ÿ˜„

snow oxide
#

works perfectly, thank you so much! having fun, and I hope you get to code more soon! blessings!

heavy gust
#

Thank you!!! ๐Ÿ˜