For the complete documentation index, see llms.txt. This page is also available as Markdown.

Signature verification

Under Development

KwikPaisa signs every webhook request using HMAC SHA256 to ensure webhook authenticity and payload integrity.

Webhook signature verification helps merchants:

  • Verify webhook authenticity

  • Prevent unauthorized requests

  • Detect payload tampering

  • Protect webhook endpoints against replay attacks

All webhook requests should always be verified before processing transaction data.


Webhook Headers

Every webhook request contains:

Content-Type: application/json
X-SIGNATURE: GENERATED_SIGNATURE
X-TIMESTAMP: GENERATED_TIMESTAMP

Signature Formula

Refer to: \

➡️ Signature Generation

Verification Process

To verify a webhook request:

  1. Read the raw webhook payload

  2. Extract X-SIGNATURE header

  3. Extract X-TIMESTAMP header

  4. Generate local HMAC SHA256 signature

  5. Compare generated signature with received signature

  6. Process webhook only if signatures match


Important Rules

  • Use the raw request payload exactly as received

  • Do not modify JSON formatting before verification

  • Verify timestamps to prevent replay attacks

  • Reject invalid signatures immediately

  • Always use your server-side secret_key


Example Webhook Payload


Common Verification Failures

Invalid Signature

Possible reasons:

  • Incorrect secret key

  • Modified payload

  • Incorrect JSON formatting

  • Wrong timestamp

  • Incorrect signature generation logic


Expired Timestamp

Possible reasons:

  • Delayed webhook processing

  • System time mismatch

  • Replay attack prevention triggered


Security Recommendations

  • Always verify webhook signatures

  • Use HTTPS webhook endpoints only

  • Reject invalid requests immediately

  • Store webhook logs securely

  • Verify timestamps before processing

  • Never expose secret keys publicly


Replay Attack Protection

KwikPaisa includes timestamps in webhook requests to prevent replay attacks.

Replay attacks occur when attackers resend previously valid webhook payloads maliciously.

To prevent replay attacks:

  • Validate timestamps

  • Reject old requests

  • Store processed webhook event IDs

  • Implement idempotent processing


  1. Receive webhook request

  2. Read raw payload

  3. Extract headers

  4. Verify signature

  5. Validate timestamp

  6. Store webhook event

  7. Verify transaction using APIs

  8. Update internal systems

  9. Return HTTP 200 response


Best Practices

  • Process webhooks asynchronously

  • Avoid long-running webhook responses

  • Return HTTP 200 quickly

  • Verify payment/payout status using APIs

  • Maintain webhook audit logs

Last updated