#Jannik

1 messages ยท Page 1 of 1 (latest)

hollow sphinxBOT
vernal mesa
edgy sapphire
vernal mesa
#

thanks.! one more thing. ```paymentRouter.post("/create-checkout-session", async (req: any, res: any) => {
const user = await UserModel.findById(req.userId)
const session = await stripe.checkout.sessions.create({
line_items: [
{
// Provide the exact Price ID (for example, pr_1234) of the product you want to sell
price: "price_1MBjShBxbqzVV8bqwpWUzjZE",
quantity: 1,
},
],
mode: "payment",
success_url: ${process.env.STRIPE_DOMAIN_REDIRECT_URL}/success-payment,
cancel_url: ${process.env.STRIPE_DOMAIN_REDIRECT_URL}/failure-payment,
automatic_tax: { enabled: true },
});
console.log(session);

res.json(session.url);
});

edgy sapphire
vernal mesa
#

thanks, does it work the same with onetime payments instead of a subscription?=

edgy sapphire
#

Yes it works too for payment mode

vernal mesa
#

one more problem ๐Ÿ™‚ metadata: { email: 'koesterjannik1998@gmail.com' }, this is in my meta data object. then im doing the payment and im receiving a success from my webhook, but without that metadata. i need that metadata to see who of my users has bought it

#

but the webhook metadata is empty

edgy sapphire
#

Could you please share the eventId you are refering to ?

vernal mesa
#

fixed it, i had to use payment_intent_data instead of metadata ๐Ÿ™‚

#

thank you !

edgy sapphire
#

Glad to hear that! Don't hesitate to come back if you have any follow up Questions ๐Ÿ™‚