I have this below:
app.get('/create-checkout-session', async (req, res) => {
let customer = {
price: req.query.price,
quantity: req.query.quantity,
page: req.query.page,
email: req.query.email,
name: req.query.name
}
let successurl = 'http://localhost:1111/' + customer.page + ''
let failedurl = 'http://localhost:1111/' + customer.page + ''
const session = await stripe.checkout.sessions.create({
payment_method_types: ['card'],
customer_email: customer.email,
line_items: [
{
price_data: {
currency: 'cad',
product_data: {
name: customer.page
},
unit_amount: customer.price,
},
quantity: customer.quantity,
},
],
payment_intent_data: {
metadata: {
'desc': customer.page
}
},
mode: 'payment',
success_url: successurl,
cancel_url: failedurl,
})
res.redirect(303, session.url);
});
I tried to pass the metadata, but it doesn't work at all. It says empty when i get the object back after.
i've never had this before, and can't really figure out what's wrong. Any ideas?