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
String
optional
application/json; charset=utf-8
X-Onmeta-Signature
String
required
{{signature-of-the-request}} as computed above.
Body Parameters
fiat
String
required
fiat amount
receiverWalletAddress
String
required
receiver Wallet address
buyTokenSymbol
String
required
token symbol ex: BTC/USDC
buyTokenAddress
String
required
smart contract of the token example : "0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889" for WMATIC
orderId
String
required
order ID - unique for a given ID
status
String
required
order status : "completed"
currency
String
required
currency type example: "inr"
chainId
Number
required
block chain ID : example: "80001" for polygon testnet
customer
Object
required
txnHash
String
required
transaction hash for completed order.
transferredAmount
String
required
quantity of crypto tokens transferred
transferredAmountWei
String
required
transferredAmount in Gwei
createdAt
String
required
created time
eventType
String
required
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