From f38f3f403b64083729d3feb64a2c9c0c10ee8c90 Mon Sep 17 00:00:00 2001 From: Lukasz Ostrowski Date: Mon, 13 Mar 2023 11:08:19 +0100 Subject: [PATCH] Update saleor-webhook.md (#214) --- docs/saleor-webhook.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/saleor-webhook.md b/docs/saleor-webhook.md index 36097af..ba8f3e2 100644 --- a/docs/saleor-webhook.md +++ b/docs/saleor-webhook.md @@ -22,6 +22,15 @@ In Next.js pages create a page, e.g. `pages/api/webhooks/order-created.ts`. We r ```typescript import { SaleorAsyncWebhook } from "@saleor/app-sdk/handlers/next"; +/** +* Default body parser must be turned off - raw body is needed to verify signature +* / +export const config = { + api: { + bodyParser: false, + }, +}; + /** * To be type-safe, define payload from API. This should be imported from generated GraphQL code */ @@ -37,6 +46,15 @@ For `SaleorSyncWebhook` it will be similar. Create e.g. `order-calculate-taxes.t ```typescript import { SaleorSyncWebhook } from "@saleor/app-sdk/handlers/next"; +/** +* Default body parser must be turned off - raw body is needed to verify signature +* / +export const config = { + api: { + bodyParser: false, + }, +}; + /** * To be type-safe, define payload from API. This should be imported from generated GraphQL code */ @@ -109,6 +127,15 @@ type OrderPayload = { id: string; }; +/** +* Default body parser must be turned off - raw body is needed to verify signature +* / +export const config = { + api: { + bodyParser: false, + }, +}; + export const orderCreatedWebhook = new SaleorAsyncWebhook({ name: "Order Created", webhookPath: "api/webhooks/order-created", @@ -157,6 +184,15 @@ type Payload = { }; }; +/** +* Default body parser must be turned off - raw body is needed to verify signature +* / +export const config = { + api: { + bodyParser: false, + }, +}; + export const orderCalculateTaxesWebhook = new SaleorAsyncWebhook({ name: "Order Calculate Taxes", webhookPath: "api/webhooks/order-created",