I want to get the cost of changing the quantity of a subscription using Stripe. I found the Upcoming API, which looks like it should work, but I've not been able to work out the right combination of arguments to pass to it.
This returns the error You must pass one of plan, price, or price_data.:
$this->stripe->invoices->upcoming([
'customer' => $this->stripe_id,
'subscription' => $this->subscription_id,
'subscription_items' => [[
'quantity' => $quantity
]]
]
But when I add the price id, as below, I get the error Cannot add multiple subscription items with the same plan: price_1H...
$this->stripe->invoices->upcoming([
'customer' => $this->stripe_id,
'subscription' => $this->subscription_id,
'subscription_items' => [[
'price' => $this->price_id,
'quantity' => $quantity
]]
]));
Removing the subscription id then only returns the cost of a brand new subscription, not the prorated invoice for the existing one.