Skip to main content

Overview

Chainrails webhooks allow you to receive real-time notifications for both cross-chain intents and ramp orders. Instead of polling the API for status updates, webhooks push event data to your server when significant state changes occur.

Quick Start

1. Create a Webhook

You’d rarely need to do this manually, as you can create webhooks directly from the Dashboard. But if you want to create one programmatically, here’s how:
Response:
⚠️ Important: Save the secret value - it’s only returned once when creating or regenerating the webhook. You’ll need it to verify webhook signatures.

2. Implement Your Webhook Endpoint

Your webhook endpoint must:
  • Accept POST requests
  • Respond with 200 OK within 5 seconds
  • Verify the signature (instructions below)
  • Be publicly accessible (HTTPS required for live webhooks)
For local testing, you can use tools like ngrok to expose your local server to the internet.

Event Types

Subscribe to the events relevant to your use case:

Intent Events

Ramp Order Events

Ramp webhooks expose a provider-agnostic lifecycle. Provider-specific intermediate statuses are normalized into the event set above.

Webhook Payload Structure

All webhook events follow this structure:

Ramp Event Example

Ramp events follow the same top-level shape, but with ramp order fields in data:

Field Descriptions

  • id: Unique identifier for this webhook event (idempotency key)
  • type: One of the event types
  • created_at: When the event occurred (UTC, ISO 8601)
  • data: Event-specific payload (intent fields for intent events, ramp fields for ramp events)
  • previous_attributes: What changed (only for update events)

Ramp Data Fields

  • ramp_order_id: Internal ramp order ID
  • order_ref: Client-facing order reference
  • ramp_direction: on-ramp or off-ramp
  • ramp_status: Current normalized ramp status
  • fiat_currency: Fiat currency code (ISO 4217)
  • fiat_amount: Fiat amount for the order
  • crypto_amount: Crypto amount involved in the order
  • crypto_currency: Crypto asset symbol (for example USDC)
  • payment_channel: Payment channel used by the provider
  • ramp_provider: Provider handling the order
  • intent_address: Linked intent address (when available)

Security & Signature Verification

All webhook payloads are signed using HMAC-SHA256. Always verify signatures to ensure the webhook came from Chainrails.

How Signing Works

  1. Chainrails generates a signature using your webhook secret
  2. Signature is sent in the X-Chainrails-Signature header
  3. Timestamp is sent in the X-Chainrails-Timestamp header
  4. You verify the signature matches what you compute

Signature Format

The signature is computed as:

Verification Example (Node.js)


Delivery & Retries

Delivery Behavior

  • Timeout: Webhooks must respond within 5 seconds
  • Success: Any 2xx status code (200, 201, 204, etc.)
  • Failure: Timeouts, network errors, or non-2xx responses
  • Retries: Automatic retry with exponential backoff

Retry Schedule

Failed deliveries are automatically retried: After 7 attempts, the delivery is marked as permanently failed.

Sample Implementation