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",