Offramp API Integration.
Web hook - Offramp
5 min
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 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 β¬οΈ let hmac = crypto createhmac('sha256', apisecret); hmac update(json stringify(postbody)); let hash = hmac digest('hex'); assert(hash == headers\["x onmeta signature"]) tab examples url configured webhook url name completed order method post request pathparameters queryparameters headerparameters kind optional name content type t type string children description application json; charset utf 8 kind required name x onmeta signature type string children description signature of the request as computed above bodydataparameters kind required name fiat type number description fiat amount kind required name senderwalletaddress type string children description receiver wallet address kind required name selltokensymbol type string children description token symbol ex btc usdc kind required name selltokenaddress type string children description smart contract of the token example 0x9c3c9283d3e44854697cd22d3faa240cfb032889 for wmatic kind required name orderid type string children description order id unique for a given id kind required name status type string children description order status completed kind required name currency type number children description currency type example inr kind required name chainid type number children description block chain id example 80001 for polygon testnet kind required name customer type object children kind required name id type string description customer id kind required name email type string description customer email id kind required name phone type string description customer phone number kind required name created at type string description order created time description kind required name created at type string children description created time kind required name updated at type string children description updated time kind required name tenantid type string children description merchant id kind required name transactionid type string children description unique transaction id for payout kind required name tokensdeducted type number children description tokens deducted to create this order kind required name tds type number children description tax deducted at source for this order kind required name eventtype type string children description onramp offramp kind required name source type string children description formdataparameters results languages id npjymzyxxlvcqvch6ejqj code language 200 customlabel id ukb mialynbkxyqiyez9n code language 404 customlabel selectedlanguageid npjymzyxxlvcqvch6ejqj examples languages id gll1chxfh1fa6hychiadp code curl location g request post configured webhook url n header accept application json n header content type string n header x onmeta signature string n data raw fiat string receiverwalletaddress string buytokensymbol string buytokenaddress string orderid string status string currency string chainid number customer object txnhash string transferredamount string transferredamountwei string createdat string language curl customlabel id 6kaniwwqdkg3jdgs6bw8 code var request require request ; nvar options n method post n url configured webhook url n headers n accept application json n content type string n x onmeta signature string n n body fiat string receiverwalletaddress string buytokensymbol string buytokenaddress string orderid string status string currency string chainid number customer object txnhash string transferredamount string transferredamountwei string createdat string n n ; nrequest options function error response n if error throw new error error ; n console log response body ; n ; n language nodejs customlabel id aexbmpycp3g1i djcbg8f code var myheaders new headers ; nmyheaders append accept application json ; nmyheaders append content type string ; nmyheaders append x onmeta signature string ; n nvar raw fiat string receiverwalletaddress string buytokensymbol string buytokenaddress string orderid string status string currency string chainid number customer object txnhash string transferredamount string transferredamountwei string createdat string ; n nvar requestoptions n method post n headers myheaders n body raw n redirect follow n ; n nfetch configured webhook url requestoptions n then response response text n then result console log result n catch error console log error error ; language javascript customlabel id vsqhbluqchzymu3t2h4qi code import requests n nurl configured webhook url n npayload fiat string receiverwalletaddress string buytokensymbol string buytokenaddress string orderid string status string currency string chainid number customer object txnhash string transferredamount string transferredamountwei string createdat string nheaders n accept application json n content type string n x onmeta signature string n n nresponse requests request post url headers headers data payload n nprint response text n language python customlabel id qiv52qtjpeaeaegvun0pw code require uri nrequire net http n nurl uri configured webhook url n nhttp net http new url host url port ; nrequest net http post new url nrequest accept application json nrequest content type string nrequest x onmeta signature string nrequest body fiat string receiverwalletaddress string buytokensymbol string buytokenaddress string orderid string status string currency string chainid number customer object txnhash string transferredamount string transferredamountwei string createdat string n nresponse http request request nputs response read body n language ruby customlabel selectedlanguageid 6kaniwwqdkg3jdgs6bw8 description 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 n currentnewparameter label body parameter value bodydataparameters eventtype will be offramp 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 { "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" }, "created at" , "updated at" , "tenantid" "122345677", "transactionid" "s11fwknm931" "tokensdeducted" 1 22, "tds" 1, "eventtype" "offramp" } offramp webhook events onmeta offramp flow allows you to receive real time notifications through webhook events when certain events occur there are four types of webhook events that are supported in this flow pending this event is triggered when a user has initialised the order but crypto transfer is pending orderreceived this event is triggered when a user transfers crypto and the tokens are received by onmeta inprogress (optional) this event is triggered when the order is in progress on the blockchain while swapping tokens (in case of non base tokens) cryptoreceived when we successfully validate the crypto received from user we send this event payoutsuccess this event is triggered when the fiat amount is successfully deposited in the users bank account refunded 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"} }