website logo
Home
Widget
API
Navigate through spaces
⌘K
Submitting KYC Data
📥Onramp API Integration.
👤Customer login
Crypto Tokens
Crypto Token Quotation
📑Orders
🪝Web hook - Onramp
📤Offramp API Integration.
👤Customer login
📑Create Order Offramp
📈Quotation
🪝Web hook - Offramp
Docs powered by archbee 

Web hook - Onramp

7min

This section explains the steps to configure callback URLs for receiving events about the completed transaction.

Configuring Webhook

Webhooks are configured in merchant dashboard.

Inside API Setup section, webhook can be added and modified under Callback URL's section.

Document image


Generating HMAC

Signature is computed using Hash-based message authentication code (HMAC) using a secret key. The secret key is the API Secret present in your merchant dashboard.

The example implementation in Nodejs is show below ⬇️

Node.js
|
let hmac = crypto.createHmac('sha256', apiSecret);
hmac.update(JSON.stringify(postBody));
let hash = hmac.digest('hex');
assert(hash == headers["X-Onmeta-Signature"])

This callback will be triggered when the crypto coins are deposited to the given receiver address. will use the configured webhook url to send order completed details in POST body.
POST
Params
Header Parameters
Content-Type
optional
String
application/json; charset=utf-8
X-Onmeta-Signature
required
String
{{signature-of-the-request}} as computed above.
Body Parameters
fiat
required
String
fiat amount
receiverWalletAddress
required
String
receiver Wallet address
buyTokenSymbol
required
String
token symbol ex: BTC/USDC
buyTokenAddress
required
String
smart contract of the token example : "0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889" for WMATIC
orderId
required
String
order ID - unique for a given ID
status
required
String
order status : "completed"
currency
required
String
currency type example: "inr"
chainId
required
Number
block chain ID : example: "80001" for polygon testnet
customer
required
Object
txnHash
required
String
transaction hash for completed order.
transferredAmount
required
String
quantity of crypto tokens transferred
transferredAmountWei
required
String
transferredAmount in Gwei
createdAt
required
String
created time
eventType
required
String
onramp/offramp


eventType will be onramp for this order

Make sure you have firewall rule allowed for receiving the webhook body if not your firewall might block our webhook requests.

Sample body

JS
|
{
  "fiat":100,
  "receiverWalletAddress":"0x14o2422324232323232323232232",
  "buyTokenSymbol":"MATIC",
  "buyTokenAddress":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
  "orderId":"63c93f0ffa666e128b7ab131",
  "status":"completed",
  "currency":"INR",
  "chainId":80001,
  "customer":{
    "id":"63aaedf35b07a87b1f912023",
    "email":"test@test.com",
    "phone":{
    },
    "created_at":"2022-12-27T13:06:59.068Z"
  },
  "createdAt":"2023-01-19T13:01:03.289Z",
  "txnHash":"0xae21ff484bd2d05d22f6....7d1f795e9e09cda97b4d522",
  "transferredAmount":"0.01",
  "transferredAmountWei":"10000000000000000",
  "eventType":"onramp",
  "metaData" :  "metaData": {
      "conversionRate": "90.2",
      "commission": "0"
    }
}




  • transferredAmount and transferredAmountWei will be sent in fiatPending and completed state
  • conversionRate and commission is sent inside the metaData along with user-set metaData (if any) in the completed state



Webhook Events

Onramp Webhook Events

Onmeta provides six types of webhook events that allow you to receive real-time notifications when specific events occur during the onramp flow.

  1. fiatPending - This event is triggered when a user has initialised an order but fiat deposit from user is pending.
  2. orderReceived - This event is triggered when a user completes payment and Onmeta has initiated the crypto transfer.
  3. InProgress (Optional) - This event is triggered when the order is in-progress on the blockchain.
  4. transferred - This event is triggered when a user's token transfer is confirmed on the blockchain.
  5. completed - This event is triggered when a user's order is completed and the user has received the tokens.
  6. expired - When an order remains pending for more than three hours, the order is expired and this webhook event is triggered.

Note : Optional events will occur when using non-native tokens



Example Webhook Request :

JSON
|
  {   
    "fiat":100,
    "receiverWalletAddress":"0xF12dc1E2EEb4d0475DE270447A92a481635caF4a",   "buyTokenSymbol":"MATIC",
    "buyTokenAddress":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
    "orderId":"641c30286ad7d01834a02e2c",  
    "status":"fiatPending",
    "currency":"INR",
    "chainId":137,
    "customer":{"id":"web52390easf35fas2a25d3fffwsdae",
    "email":"documentation@onmeta.in",
    "phone":{},
    "created_at":"2023-01-04T06:58:24.968Z"},
    "createdAt":"2023-03-23T10:55:36.584Z",
    "txnHash":"",
    "transferredAmount":"0.990628",
    "transferredAmountWei":"990628498656169300",
    "eventType":"onramp",
    "metaData":{"submeta1":"metadata"}
  }






Updated 17 May 2023
Did this page help you?
Yes
No
PREVIOUS
Supported Currencies
NEXT
Offramp API Integration.
Docs powered by archbee 
Completed Order