#femina - Update Subscription
1 messages · Page 1 of 1 (latest)
Hello
Can you share the request ID for the request that generated this error?
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
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
Thanks, looking
Ok
I have tried many alternate way. Not sure where i am wrong
here is another id : req_qd3mATPYnKp8wa
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
You need to pass the items parameter, which is an array of hashes
https://stripe.com/docs/api/subscriptions/update?lang=php#update_subscription-items
Oh, wait, sorry
You did provide items in the second request.
But items needs to be an array, not a hash
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
]
]
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.
ok