Webhook updates

During onboarding merchants can give webhook endpoint to get updates of user transactions. This is sample webhook response sent to the endpoint. Values can be checked against the values in config file

To get your API key and secret, please fill out the form.

We only send a webhook when a transaction is successfully completed and withdrawal is processed. If the webhook url is not set before the transaction is completed, the webhook would not be sent.

We expect a response to the webhook call within 5 seconds. If response is not received we will mark it as a webhook failure and will send the webhook again.

Kindly use an HTTPS endpoint with a valid SSL certificate that is trusted by your browser else it would result in missing webhook updates at times.

Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already logged events.

Note :

  1. The updatedAt field in the webhook is for internal purposes and should not to be used by the client. It will soon be deprecated from the data sent in the webhook.

  2. For Status codes and its meaning, please to refer to link.

  3. If webhooks are not enabled, transactions that complete successfully will be assigned a status code of either 4 or 15.

Authentication code webhook

var CryptoJS = require('crypto-js');
var express = require('express');
var router = express.router();

function verifyWebhook(req, res, next) {
  let payload = req.headers['x-onramp-payload'];
  let signature = req.headers['x-onramp-signature'];
  const localSignature = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA512(payload, 'YOUR_API_SECRET'));
  if(localSignature == signature){
    // signature verified
    return next();
  }
  return res.status(403).send("Invalid signature passed");
}

router.post('/webhookEndpoint', verifyWebhook, (req, res) => {
  // whatever you need to do with the data
  res.status(200).send("Received data :)");
})
// headers received in webhook
{
   "x-onramp-payload": "SOME_VALUE",
   "x-onramp-signature": "SOME_SIGNATURE"
}

// data received in webhook
{
   "orderId":9,
   "walletAddress":"0x12345678900987654321",
   "coinId":54,
   "fiatType":1,
   "expectedPrice":87,
   "fiatAmount":100,
   "paymentType": 1
   "expectedCryptoAmount":0.89,
   "actualPrice":87,
   "actualCryptoAmount":0.88,
   "kycNeeded": 0,
   "createdAt":"2022-10-08T06:25:17.000Z",
   "updatedAt":"2022-11-09T16:58:07.000Z",
   "status":5,
   "referenceId":"227912121212",
   "chainId":3,
   "onRampFee":2.49,
   "gasFee":0.25,
   "clientFee":2.49,
   "gatewayFee":2.5,
   "transactionHash":"0x61refuyiasfdvisuaogdhsaidur35624324",
   "merchantRecognitionId":'13422',
   "webhookTrials": 0,
   "coinCode":"usdt",
   "network":"matic20"
}

Last updated