Skip to content

Commit 5ca41bf

Browse files
committed
better stripe webhook validation
1 parent 6ff5466 commit 5ca41bf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/actions/stripeWebhook.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ const StripeWebhookParams = new Archetype({
2525
}
2626
}).compile('StripeWebhookParams');
2727

28-
module.exports = async function stripeWebhook(params, req) {
29-
console.log('AB', req, process.env.STRIPE_WEBHOOK_SECRET);
28+
module.exports = async function stripeWebhook(params, event) {
29+
console.log('AB', event.body, process.env.STRIPE_WEBHOOK_SECRET);
3030
try {
31-
stripe.client.webhooks.constructEvent(req.rawBody, req.headers['stripe-signature'], process.env.STRIPE_WEBHOOK_SECRET);
31+
stripe.client.webhooks.constructEvent(event.body, event.headers['stripe-signature'], process.env.STRIPE_WEBHOOK_SECRET);
3232
} catch (err) {
3333
console.log('Caught', err);
3434
throw new Error('Invalid webhook signature');

0 commit comments

Comments
 (0)