const stripe = require('stripe')('sk_test_N40lkQF39cKP4Nw3m0NAJtvf00jGnKw7cW'); const express = require('express'); const app = express(); app.use(express.static('.')); const YOUR_DOMAIN = 'http://localhost:4242'; app.post('/create-session', async (req, res) => { const session = await stripe.checkout.sessions.create({ customer_email: 'customer@example.com', submit_type: 'donate', billing_address_collection: 'auto', shipping_address_collection: { allowed_countries: ['US', 'CA'], }, payment_method_types: ['card'], line_items: [ { price_data: { currency: 'usd', product_data: { name: 'Stubborn Attachments', images: ['https://i.imgur.com/EHyR2nP.png'], }, unit_amount: 2000, }, quantity: 1, }, ], mode: 'payment', success_url: `${YOUR_DOMAIN}/success.html`, cancel_url: `${YOUR_DOMAIN}/cancel.html`, }); res.json({ id: session.id }); }); app.listen(4242, () => console.log('Running on port 4242'));