#femina - Update Subscription

1 messages · Page 1 of 1 (latest)

flint wharf
#

Hi 👋

calm escarp
#

Hello

flint wharf
calm escarp
#

here is the syntax

#

$subscriptionDetail = \Stripe\Subscription::update(
$subscriptionID, ['items' => ['price_data' => [
"currency" => "usd",
'unit_amount' => ($newPrice ?? $newPrice) * 100,
'product'=> $productID,
"recurring" => [
"interval"=>"day"
]
]],
'quantity' => 1
]
);

#

Here is the Request ID :req_k00QcEqqc6TphF

flint wharf
#

Thanks, looking

calm escarp
#

Ok

#

I have tried many alternate way. Not sure where i am wrong

#

here is another id : req_qd3mATPYnKp8wa

flint wharf
#

In the first request you shared there was an extra layer to the price_data property. It went items.data.price_data. In the second request you skipped the items parameter altogether.

#

Neither of those requests appear to have been made with the PHP code you shared earlier

#

Oh, wait, sorry

#

You did provide items in the second request.

#

But items needs to be an array, not a hash

calm escarp
#

Yes i am following same document

#

Yes items is an array not hash

#

This way i am using

array:1 [â–¼
"items" => array:2 [â–¼
"price_data" => array:3 [â–¼
"currency" => "usd"
"unit_amount" => 49900
"product" => "prod_M11gVq59XWvPzj"
]
"quantity" => 1
]
]

flint wharf
#

I know that's how PHP structures it but it's not coming into the API that way. The array:2 is a has because it has keys mapped to values. Add one more set of brackets around that.

calm escarp
#

ok