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 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"]) 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 { "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 \# 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 { "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"} }