Webhooks

Webhooks allow you to receive real-time notifications when events happen in your Bedrock account. When an event occurs, Bedrock sends an HTTP POST request to your configured webhook URL.

Setup

  1. Go to Settings in your dashboard

  2. Enter your Webhook URL (must be HTTPS)

  3. Copy the generated Webhook Secret for signature verification

Webhook Payload

All webhooks follow this structure:

{
  "event": "charge.completed",
  "timestamp": "2024-01-15T12:15:00Z",
  "data": {
    "id": "chrg_abc123def456",
    "orderId": "order-123",
    "amount": "25.00",
    "amountReceived": "25.00",
    "feeAmount": "0.25",
    "netAmount": "24.75",
    "status": "COMPLETED",
    "chainId": 8453,
    "flushTxHash": "0xabcd..."
  }
}

Headers

Header
Description

Content-Type

application/json

X-Bedrock-Signature

HMAC-SHA256 signature for verification

X-Bedrock-Timestamp

Unix timestamp when the webhook was sent

Retry Policy

If your endpoint doesn't return a 2xx response, Bedrock will retry the webhook:

Attempt
Delay

1

Immediate

2

1 minute

3

5 minutes

4

30 minutes

5

2 hours

After 5 failed attempts, the webhook is marked as failed.

Best Practices

  1. Return 200 quickly - Process webhooks asynchronously

  2. Verify signatures - Always validate the webhook signature

  3. Handle duplicates - Use idempotency keys to prevent double-processing

  4. Use HTTPS - Webhook URLs must use HTTPS

  5. Log everything - Keep logs for debugging

Testing Webhooks

Use tools like ngrokarrow-up-right to expose a local endpoint for testing:

Then use the ngrok URL as your webhook URL in Settings.

Last updated