#marcowoldering
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- marcowoldering, 1 day ago, 22 messages
Hi 👋 no, you cannot update an existing Price object. You will need either create a new Price with the desired interval_count and update the Subscription to use that new price; or update the Subscription and create a new Price adhoc using price_data.
do i need to do this for every item in the subscription or is it possible to do it once for all?
if i create a new Price and then assign it, will it then become a Plan if i understand correctly?
Yes, you would need to do this for every item on the subscription if you want it to have a different cycle length
Plans are legacy objects that came before the current Price API
I am not sure what you mean by assigning it, but that does not change what type of object you are working with
if the plan is legacy it is clear to me. I have a subscription with items, but my platform doesnt allow for items to have different intervals, so it has to be the same for all items.
using the stripe-php library
Right, that is a Stripe restriction on subscriptions. For a multi-item subscription I think you would need to change all of the prices at once
I think i need to do it like this:
update(
'sub_xxxxxxxxx',
[
'items' => [
[
'id' => '{{SUB_ITEM_ID}}',
'price' => '{{NEW_PRICE_ID}}',
],
],
]
)
Because the interval needs to be the same but the price itself can be different
update(
'sub_xxxxxxxxx',
[
'items' => [
[
'id' => '{{SUB_ITEM_ID}}',
'deleted' => true,
],
['price' => '{{NEW_PRICE_ID}}'],
],
]
)
this will give all items the same price i think i assume
Yep those would be how you would update the subscription to the new plans
Ok i will try this, thanks for the clarification
I get:
The product prod_P5YhPs0paksZyu is marked as inactive, and thus no new subscriptions can be create to any plans of this product. You provided the plan price_1OHTKtCI7ahsAhgW3DHLwamk.
does this mean i have to create a whole new product?
the initial product is created by the checkout but is archived automatically
Yep, you will need to create a new product and create new prices on that product
creating the product works, but it charged the subscription again, i dont want this, the updated subscription should be charged on the already set date, I looked in the docs and have now set 'proration_behavior' to 'none' but it still charges
Yes, any call to the subscription update endpoint will update the subscription immediately. If you want the changes to apply in future you can use a subscription schedule https://stripe.com/docs/billing/subscriptions/subscription-schedules