#camer
1 messages · Page 1 of 1 (latest)
404 means that your local server doesn't have endpoint http://localhost:3000/create-checkout-session
Could you share you implement /create-checkout-session?
Definitely one moment
am I understanding correctly that you're asking about the code in that file?
Yes, this is the code. Could you share the code in text, so that I can test at my side? Please remove the secret key from the code if you share it 🙂
ok will do!
const express = require('express');const app = express();const stripe = require('stripe')('')app.post('/create-checkout-session', async (req, res) => { const session = await stripe.checkout.sessions.create({ line_items: [ { price_data: { currency: 'usd', product_data: { name: 'T-shirt', }, unit_amount: 2000, }, quantity: 1, }, ], mode: 'payment', success_url: 'http://localhost:3000/success', cancel_url: 'http://localhost:3000/cancel', }); res.redirect(303, session.url);});app.listen(3000, () => console.log(Listening on port ${3000}!));
is there a better way to send the text?
and then I imagine you'll also need the checkout component
the code looks right, but i'm checking if i miss anything
gotcha
i tested with your code and it works fine for me
ok
i'm able to be redirected to the checkout session url