#shivam_kumar
1 messages · Page 1 of 1 (latest)
hi, you don't, you create a new Price instead. Prices are immutable by design.
Ok
But In stripe dashboard we can update subscription amount.
Can we do same thing using Api?
the dashboard lets you change the Price amount if the Price hasn't been used yet anywhere
the API does not allow that, it's a special Dashboard thing
what are you overall trying to do?
I am working on subscription feature for my website I want admin can create a product , and update any time, But when I try to update price then I got error.
well then as I said you can't change a Price after it's created
so maybe you want to build the Admin section so that you don't actually create the Price in the Stripe API until the user has decided on the final amount on the frontend
or if they change the amount, you implement that by archiving(https://stripe.com/docs/api/prices/update?lang=node#update_price-active set to false) the existing Price and creating a new one.
I every time create a new price Id for each user ?
$priceId = '{{PRICE_ID}}';
$session = \Stripe\Checkout\Session::create([
'success_url' => 'https://example.com/success.html?session_id={CHECKOUT_SESSION_ID}',
'cancel_url' => 'https://example.com/canceled.html',
'mode' => 'subscription',
'line_items' => [[
'price' => $priceId,
// For metered billing, do not pass quantity
'quantity' => 1,
]],
]);
not sure what you mean.
My mean is, can we use same price id for multiple users