Skip to main content

Signature Validation

For security, all webhooks from Chipi Pay include an HMAC signature in the chipi-signature header. You should verify this signature to ensure the webhook is from Chipi Pay and hasn’t been tampered with.

Why Verify Signatures?

Always verify webhook signatures in production. This prevents unauthorized requests and ensures data integrity.
Webhook signature verification:
  • Prevents spoofing - Ensures requests are from Chipi Pay
  • Protects data integrity - Detects if payloads have been modified
  • Security best practice - Industry standard for webhook security

Getting Your Webhook Secret

  1. Go to your webhook configuration page in the Chipi Dashboard
  2. Copy your Webhook Signing Secret (it looks like whsec_****)
  3. Store it securely as an environment variable

Implementation

Step 1: Install Required Dependencies

Step 2: Create a Signature Verification Function

Step 3: Verify in Your Webhook Handler

Security Best Practices

  • Always use timing-safe comparison functions to prevent timing attacks
  • Store your webhook secret in environment variables, never in code
  • Verify signatures before processing any webhook data
  • Log failed signature verifications for security monitoring

Common Issues

Signature Mismatch

If you’re getting signature mismatches:
  1. Ensure you’re using the correct webhook secret from your dashboard
  2. Verify you’re reading the raw request body (not parsed JSON)
  3. Check that the chipi-signature header is being read correctly
  4. Make sure you’re using SHA-256 HMAC

Environment Variables

Store your webhook secret securely:

Next Steps