#Jannik
1 messages ยท Page 1 of 1 (latest)
hey, fixed it. my middleware express.json has modified the request in a bad way i guess. May you write this into your docs? https://dashboard.stripe.com/test/webhooks/create?endpoint_location=local i think other people will have problems with it aswell
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Hello
Yes in fact the request body need to be untouched, You need to make sure that there is no middleware that modifying the request body.
You can follow this Stripe official nodejs sample project:
https://github.com/stripe/stripe-node/blob/master/examples/webhook-signing/typescript-node-express/express-ts.ts
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);
});
Yes of course, you can rely on the Subscription metadatas:
https://stripe.com/docs/api/subscriptions/create#create_subscription-metadata
Fill free to add whatever data you need. ONce you get the webhook event you'll get that data back
thanks, does it work the same with onetime payments instead of a subscription?=
Yes it works too for payment mode
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
Could you please share the eventId you are refering to ?
Glad to hear that! Don't hesitate to come back if you have any follow up Questions ๐