#camer

1 messages · Page 1 of 1 (latest)

dusky cliffBOT
charred thistle
#

Could you share you implement /create-checkout-session?

unreal phoenix
#

Definitely one moment

#

am I understanding correctly that you're asking about the code in that file?

charred thistle
#

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 🙂

unreal phoenix
#

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

charred thistle
#

the code looks right, but i'm checking if i miss anything

unreal phoenix
#

gotcha

charred thistle
#

i tested with your code and it works fine for me

unreal phoenix
#

ok

charred thistle
#

i'm able to be redirected to the checkout session url

unreal phoenix
#

so that means I have an error somewhere else

#

hmmm

charred thistle
#

404 is likely thrown before reaching this part of the code

#

maybe you can try with a simple hello world and return 200 to ensure your express app is running correctly

unreal phoenix
#

ok

#

ilkl let you know how it goes