Webhook Security SDKs
Learn how to securely verify webhook payloads from Straddle using Svix
Verification SDKs
When working with webhooks, it’s crucial to ensure that the payloads you’re receiving are genuinely from Straddle and haven’t been tampered with. Payload verification helps you verify the authenticity of incoming requests by using security headers and signature checks, making your integration more secure against malicious actors.
In this section, you’ll learn how to verify Straddle payloads step-by-step. By following this guide, you can confidently establish that your server is interacting with trusted data, allowing you to safely process events without worrying about spoofed or modified payloads.
Whether you’re new to webhooks or just need a refresher, the following instructions will provide everything you need to get started with secure webhook verification using Straddle.
Straddle has teamed up with Svix to make webhook verification as secure and straightforward as possible. This partnership means you get the best in payload authenticity and security.
Verify with SVIX Libraries
To integrate with Straddle webhooks securely, you’ll need to install the Svix libraries for your language or framework of choice. Below are installation snippets for various languages and environments.
Use the Raw Request Body
You need to use the raw request body when verifying webhooks, as the cryptographic signature is sensitive to even the slightest changes. Avoid parsing the request and then re-stringifying it before verification.
The signature for each endpoint is available where you added the endpoint, e.g., the Straddle dashboard.
Verifying Payloads
Below is example verification code for various languages using Svix SDKs. Each code snippet shows how to verify the raw request body using the provided headers and secret.
Framework Specific Examples
Below are examples for how to handle raw request bodies and verification in various frameworks:
Python (Django)
Python (Flask)
Python (FastAPI)
Node.js (Next.js)
Node.js (Next.js 13 App Router)
Node.js (Netlify Functions)
Node.js (Express)
Node.js (NestJS)
main.ts:
webhook.controller.ts:
Go (Standard lib)
Go (Gin)
Rust (axum)
Ruby (Ruby on Rails)
config/routes.rb:
app/controllers/webhook_controller.rb: