#DeputyCheese

1 messages · Page 1 of 1 (latest)

real frigateBOT
torpid hemlock
#

Hi there!

#

And a subscription is not directly tied to a product. Instead the subscription is tied to a price, and the price is tied to a product.

#

So when you change the subscription price, if the price is tied to a different product, it will also change the product.

hazy creek
#

Thanks, got it.

#

\Stripe\Subscription::update('sub_49ty4767H20z6a', [
'cancel_at_period_end' => false,
'proration_behavior' => 'create_prorations',
'items' => [
[
'id' => $subscription->items->data[0]->id,
'price' => 'price_CBb6IXqvTLXp3f',
],
],
]);

#

If I pass the 'items' like here, will the previous item/price be removed and replaced with the new one or will it be added?

torpid hemlock
hazy creek
#

Ah okay thanks

#

So I need 2 request, 1 to delete the previous product/price and 1 to add the new one, right?

#

Ah wait or can I add both items at the same time?

torpid hemlock
#

Both can be done at the same time yes. Keep your existing code above, and just add a new [] to the items with the existing price ID and deleted: true

hazy creek
#

Okay thank you very much for your help