Skip to main content

Webhook - Off-Ramp

This section explains the steps to configure callback URLs for receiving events about completed off-ramp transactions.

Configuring Webhook

Webhooks are configured in the merchant dashboard.

Inside the Setup section, webhooks can be added and modified under the Callback URL's section.

Webhook Configuration

Webhook Security & HMAC Verification

⚠️ Always verify webhook signatures

Your webhook endpoint is a public URL — anyone on the internet can send a POST request to it. Without verification, a malicious actor could forge fake order events and trick your system into releasing goods, updating balances, or triggering downstream actions based on fraudulent data.

Why HMAC?

Every time Onmeta sends a webhook to your server, it attaches a signature in the X-Onmeta-Signature request header. This signature is a fingerprint of the exact payload that was sent, generated using a secret key only you and Onmeta share — your API Secret from the merchant dashboard.

Here's why this matters:

  • Authenticity — If the signature matches, the request genuinely came from Onmeta. Nobody else knows your API Secret, so nobody else can produce the same signature.
  • Integrity — The signature is computed over the full request body. Even a single character change in the payload would produce a completely different hash, making tampering immediately detectable.
  • Replay protection — You can extend this by rejecting events with timestamps too far in the past.

How it works

Onmeta uses HMAC-SHA256 — a standard cryptographic algorithm that combines your payload with your secret key and produces a fixed-length hex string. On your end, you run the same computation on the incoming body. If your result matches the header value, the event is genuine.

HMAC-SHA256(apiSecret, JSON.stringify(requestBody)) === X-Onmeta-Signature

Verification Example

const crypto = require('crypto');

function verifyWebhook(req) {
const receivedSignature = req.headers['x-onmeta-signature'];
const apiSecret = process.env.ONMETA_API_SECRET; // from merchant dashboard

// Recompute the HMAC using the raw request body
const hmac = crypto.createHmac('sha256', apiSecret);
hmac.update(JSON.stringify(req.body));
const expectedSignature = hmac.digest('hex');

if (expectedSignature !== receivedSignature) {
throw new Error('Invalid webhook signature — request may be forged');
}

// Safe to process
return true;
}
💡 Where to find your API Secret

Log in to your Merchant DashboardSettingsAPI Keys. Use the API Secret (not the API Key) as the HMAC secret. Keep this value private and never expose it in client-side code or public repositories.

Completed Order

POST{{configured_webhook_url}}

This callback will be triggered when the crypto coins are deposited to the given receiver address. It will use the configured webhook URL to send order completed details in the POST body.

info

Event Type: offramp

Make sure you have firewall rules configured to allow receiving the webhook body, otherwise your firewall might block our webhook requests.

Headers

NameTypeRequiredDescription
AcceptstringYesapplication/json
Content-TypestringYesapplication/json
X-Onmeta-SignaturestringYesHMAC signature for webhook verification

Request Body Parameters

ParameterTypeRequiredDescription
fiatnumberYesFiat amount
senderWalletAddressstringYesWallet address sending the crypto
sellTokenSymbolstringYesSymbol of the sold token
sellTokenAddressstringYesContract address of the sold token
orderIdstringYesUnique order identifier
statusstringYesOrder status
currencystringYesFiat currency code
chainIdnumberYesBlockchain network chain ID
customerobjectYesCustomer information object
created_atstringYesOrder creation timestamp
updated_atstringYesOrder update timestamp
tenantIdstringYesTenant identifier
transactionIdstringYesTransaction identifier
tokensDeductednumberYesAmount of tokens deducted
tdsnumberYesTDS amount
eventTypestringYesEvent type identifier (offramp)
metaDataobjectNoAdditional metadata

Code Examples

curl --location -g --request POST '{{configured_webhook_url}}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-Onmeta-Signature: string' \
--data-raw '{
"fiat": 100,
"senderWalletAddress": "0x12E217bf293b242r1r1414fcw42g1",
"sellTokenSymbol": "MATIC",
"sellTokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"orderId": "63c51a9e598f1f0fabbe8fbc",
"status": "completed",
"currency": "inr",
"source": "",
"chainId": 80001,
"customer": {
"id": "63c514c142e2ae343ed283ed",
"name": "",
"email": "test@onmeta.com",
"phone": {
"countrycode": "",
"number": ""
},
"created_at": "2023-01-16T12:00:00.000Z"
},
"created_at": "2023-01-16T12:00:00.000Z",
"updated_at": "2023-01-16T12:30:00.000Z",
"tenantId": "122345677",
"transactionId": "S11FWKNM931",
"tokensDeducted": 1.22,
"tds": 1,
"eventType": "offramp"
}'

Response Sample

{
"fiat": 100,
"senderWalletAddress": "0x12E217bf293b242r1r1414fcw42g1",
"sellTokenSymbol": "MATIC",
"sellTokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"orderId": "63c51a9e598f1f0fabbe8fbc",
"status": "completed",
"currency": "inr",
"source": "",
"chainId": 80001,
"customer": {
"id": "63c514c142e2ae343ed283ed",
"name": "",
"email": "test@onmeta.com",
"phone": {
"countrycode": "",
"number": ""
},
"created_at": "2023-01-16T12:00:00.000Z"
},
"created_at": "2023-01-16T12:00:00.000Z",
"updated_at": "2023-01-16T12:30:00.000Z",
"tenantId": "122345677",
"transactionId": "S11FWKNM931",
"tokensDeducted": 1.22,
"tds": 1,
"eventType": "offramp"
}

Off-Ramp Webhook Events

Onmeta off-ramp flow allows you to receive real-time notifications through webhook events when certain events occur.

#Event NameDescription
1pending

This event is triggered when a user has initialised the order but crypto transfer is pending.

2orderReceived

This event is triggered when a user transfers crypto and the tokens are received by Onmeta.

3InProgress(optional)

This event is triggered when the order is in-progress on the blockchain while swapping tokens (in case of non-base tokens).

4CryptoReceived

When we successfully validate the crypto received from user we send this event.

5PayoutSuccess

This event is triggered when the fiat amount is successfully deposited in the users bank account.

6refunded

This event is triggered when refund is successfully completed in case of amount/token mismatch.

Example Webhook Request

{
"fiat": 100,
"senderWalletAddress": "0xf12dcsdadefed2eeb4d0475de270447a92a481635caf4a",
"sellTokenSymbol": "MATIC",
"sellTokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"chainId": 137,
"orderId": "641c311afdsaddfwcd2768aa5e",
"status": "PayoutSuccess",
"currency": "inr",
"created_at": "2023-03-23T10:59:38.494Z",
"updated_at": "0001-01-01T00:00:00Z",
"source": "",
"customer": {
"id": "63b52390dsaddefsfefwfw25d377ae",
"email": "documentation@onmeta.in",
"phone": {},
"created_at": "2023-01-04T06:58:24.968Z"
},
"tenantId": "",
"transactionId": "TRAREFXXXXXXXXX",
"tokensDeducted": 1051823.63,
"tds": 1,
"eventType": "offramp",
"metaData": {
"submeta1": "metadata"
}
}