See the code behind this demo!

Checkout ad-hoc prices

Add ad-hoc Prices to a Checkout Session

As an alternative to creating Products and Prices in the dashboard, you can pass ad-hoc Product and Price data to Stripe Checkout when creating a Checkout Session. This example is in Javascript, see the other languages in the docs.



          
  const session = await stripe.checkout.sessions.create({
    mode: "payment",
    payment_method_types: ["card"],
    line_items: [
      {
        price_data: {
          currency: 'eur',
          unit_amount: '199',
          product_data: {
            name: 'Ad hoc Coffee',
          },
        },
        quantity: 1,
      }
    ],
    success_url: `https://${process.env.BASE_URI}?success=true`,
    cancel_url: `https://${process.env.BASE_URI}?cancel=true`,
  });
          
        

Experiment and learn

Make copies, remix, change and learn how to play with this tinydemo.


Any questions?

Reach out to us on any of our contact channels: