Onramp API Integration.

Web hook - Onramp

5min

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

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
Request
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




  • 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.

#

EventName

Description

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

fiatReceived

This event is received on confirming that Onmeta has received payment for the onramp order.

5

transferred

This event is triggered when a user's token transfer is confirmed on the blockchain.

6

completed

This event is triggered when a user's order is completed and the user has received the tokens.

7

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