UNPKG

@codesled/stripe-payments

Version:

Simple Stripe checkout integration module from CodeSled

19 lines (15 loc) 455 B
const { getStripeInstance } = require("./stripeInstance"); function verifyWebhookSignature(rawBody, sigHeader) { const stripe = getStripeInstance(); try { const event = stripe.webhooks.constructEvent( rawBody, sigHeader, process.env.STRIPE_WEBHOOK_SECRET ); return event; } catch (err) { throw new Error("Webhook signature verification failed."); } } module.exports = verifyWebhookSignature;