#haris-subscriptions

1 messages · Page 1 of 1 (latest)

stable niche
#

Hi there!

foggy granite
#

but when i add subscription items to it
it actually add to the current subscription means it adds the new amount to the previous ones

stable niche
foggy granite
#

now i have 2 prices
new_price_id_1 and new_price_id_2
which i want to update in a current subscription and want to swap or substitute with the prices old_price_id_1 and old_price_id_2 in the current subscription

now before subscription_update i want to show an estimated invoice (prorated) to the customer

can you specifically tell what to do

#

$stripe->invoices->upcoming([
'customer' => 'cus_LmaGSLEiHV8W3G',
'subscription_item'=>[[
'price'=>'new_price_id_1'
],[
'price'=>'new_price_id_2'
]]
]);

im doing this right now

#

how can i tell this api to substitute the price_ids or swap the price_ids and not to just add to the previous ones

#

@stable niche and also its recurring as it is the subscription not a one time charge

stable niche
#

This code is adding new prices, not editing existing prices. To edit existing prices, you should do someting like this:

$stripe->invoices->upcoming([
  'customer' => 'cus_LmaGSLEiHV8W3G',
  'subscription_item'=>[[
    'price'=>'new_price_id_1',
    'id'=>'si_xxx' // the subscription item ID of the price you want to update
  ],[
    'price'=>'new_price_id_2',
    'id'=>'si_yyy' // the subscription item ID of the price you want to update
  ]]
]);
foggy granite
#

okay now that make some sense
let me try
if get any issue will ping you back in the same thread
thanks

foggy granite
#

You cannot update a subscription item without a subscription.

its giving this error

#

@stable niche

#

it is already subscribed customer

stable niche
foggy granite
#

req_BOHbR5s0CKZmWA

#

Response body
{ "error": { "message": "You cannot update a subscription item without a subscription.", "type": "invalid_request_error" } }
Request query parameters
{ "subscription_items": { "0": { "id": "si_LvfU9EQJKjyI4f", "price": "price_1L7dUVJOIuKIWiW6CO9hlV3a" }, "1": { "quantity": "1", "price": "price_1L7dUyJOIuKIWiW6YQaZ876U" } }, "customer": "cus_LvfPjrCBqO7zC4" }

#

here i have only 1 old price that i have to substitute or swap with.(first one)
and second im adding a new price with quantity

#

@stable niche

stable niche