diff --git a/server/server.js b/server/server.js index 514c0de..362671f 100644 --- a/server/server.js +++ b/server/server.js @@ -400,16 +400,16 @@ APP.post('/api/coinbasecommerce', async (req, res) => { const sharedSecret = COINBASE_SHARED_SECRET; // Verify the webhook notification using the shared secret -// const signature = req.headers['x-cc-webhook-signature']; -// const isValid = coinbaseLib.verifyWebhookPayload(signature, req.body, sharedSecret, Sentry); - // if (isValid) { + const signature = req.headers['x-cc-webhook-signature']; + const isValid = coinbaseLib.verifyWebhookPayload(signature, req.body, sharedSecret, Sentry); + if (isValid) { const DB = CLIENT.db(DBNAME); coinbaseLib.updateCharge(DB, Sentry, req.body); res.sendStatus(200); - /*} else { + } else { Sentry.captureException(new Error('Invalid signature for Coinbase Commerce webhook')); res.sendStatus(500); - }*/ + } }); /**