Added logging for failed webhook verification

no-issue

This gives us some more information about the secret used
This commit is contained in:
Fabien O'Carroll 2019-10-30 14:40:16 +07:00
parent f233d5fc71
commit 7a3c99886d

View File

@ -80,9 +80,14 @@ module.exports = class StripePaymentProcessor {
}
async parseWebhook(body, signature) {
const event = await this._stripe.webhooks.constructEvent(body, signature, this._webhookSecret);
debug(`Parsed webhook event: ${event.type}`);
return event;
try {
const event = await this._stripe.webhooks.constructEvent(body, signature, this._webhookSecret);
debug(`Parsed webhook event: ${event.type}`);
return event;
} catch (err) {
this.logging.error(`Error verifying webhook signature, using secret ${this._webhookSecret}`);
throw err;
}
}
async createCheckoutSession(member, planName, options) {