#Wurkzen
1 messages · Page 1 of 1 (latest)
Do we just create new prices every time we send a stripe checkout for this product_id?
You can use price_data to set dynamic amount, and it can still refer to the same product ID: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data-product
so do i create a price with the product or no?
You only need to pre-create a product. Price can be set every time a Checkout Session is created.
One question: do you have the amount at the time when you create a Checkout Session? Or you only want to collect payment information?
yes
we have the amounts
they set it prior to creating the custom checkout
so we can set dynamically for every checkout i guess
thank you!
Yes, then you can create the the Checkout session with custom amount, like this:
const session = await stripe.checkout.sessions.create({
...
line_items: [
{
price_data: {
currency: 'usd',
product: 'prod_xxx', // your existing product ID
unit_amount: 9900, // custom estimated amount for this session
}
quantity: 1
},
],
mode: 'payment',
});