typeWebhookRequest={data:{orderId:string,offrampType:"bank",status:OfframpStatus,date:string,cashout:{localCurrencyAmount:number,// how much the user will receive in local currencyusdAmount:number,// how much user must send in USDfeeAmountUsd:number,// total fee amount in USDfeeAmountUsdFonbnk:number,// fee amount in USD for FonbnkfeeAmountUsdPartner:number,// fee amount in USD for partnerfeeAmountLocalCurrency:number,// total fee amount in local currencyfeeAmountLocalCurrencyFonbnk:number,// fee amount in local currency for FonbnkfeeAmountLocalCurrencyPartner:number,// fee amount in local currency for partner},exchangeRate:number,network:"AVALANCHE"|"POLYGON"|"CELO",asset:"USDC"|"CUSD",fromAddress:string,toAddress:string,userEmail:string,requiredFields:{label:string,type:'number'|'string'|'date'|'boolean'|'email'|'phone',value:string}[],// user account dataorderParams?:string,// contents of orderParams query parameter during order creationcountryIsoCode:string,currencyIsoCode:string,},hash:string,};enumOfframpStatus{INITIATED='initiated',VALIDATING_TRANSACTION='validating_transaction',// user has sent us a transaction hash, waiting it to appear in a blockchainTRANSACTION_INVALID='transaction_invalid',// submited transaction hash is invalid (wrong amount, wrong creation time etc.)AWAITING_TRANSACTION_CONFIRMATION='awaiting_transaction_confirmation',//waiting for transaction confirmationTRANSACTION_CONFIRMED='transaction_confirmed',// user transaction was confirmedTRANSACTION_FAILED='transaction_failed',// user transaction is not confirmed in the blockchainOFFRAMP_SUCCESS='offramp_success',// user has received the fundsOFFRAMP_RETRY="offramp_retry",// we are retrying the off-ramp after a failed attemptTRANSACTION_FAILED='transaction_failed',// user transaction failedOFFRAMP_PENDING='offramp_pending',// offramp in progressOFFRAMP_FAILED='offramp_failed',// offramp failedREFUNDING='refunding',// offramp failed, refund in progressREFUNDED='refunded',// offramp failed, refund was successfulREFUND_FAILED='refund_failed',// offramp failed, refund failedEXPIRED='expired',// user did not send us a transaction hash in timeCANCELLED="cancelled"// user cancelled an order}
We send a hash field in our webhook to protect merchants from fraudulent requests. Each request should be verified by a secret provided in the dashboard.
Here is how it should be checked in pseudocode:
Here is how it should be checked in Node.js:
For Webhook V1 version:
For Webhook V2 version:
You can see how to make a signature in multiple programming languages HERE