π Webhooks
Note
The webhook payload is sent in an encrypted format. To access it, you must decrypt it using your ACCESS_TOKEN which you can generate one using our Refresh Token endpoint. To learn more, click here.
You can use jsonwebtoken
npm library to decrypt the payload data.
Below is the list of the events when we send the webhook:
On Ramp
Webhook Event Code | Description | Status Code |
---|---|---|
ORDER_PROCESSING | Orders in the PROCESSING state have passed the checks and the user's payment information has been validated. | PROCESSING |
ORDER_FAILED | When the user failed to make the payment within the timeframe. | EXPIRED |
ORDER_FAILED | When the order is failed because of the card decline. | FAILED |
ORDER_FAILED | When the user cancels the order. | CANCELLED |
ORDER_COMPLETED | When we have received the payment and the crypto is sent successfully to the user. | COMPLETED |
ORDER_PROCESSING | When the payment is received and being exchanged & transferred via us or our liquidity partner. | PENDING_DELIVERY_FROM_TRANSAK |
ORDER_PAYMENT_VERIFYING | When the user marks the payment as done but it is not received by us yet. | PAYMENT_DONE_MARKED_BY_USER |
ORDER_CREATED | When the order is created but the payment still not received. | AWAITING_PAYMENT_FROM_USER |
Off Ramp
WebSocket Event Code | Description | Status Code |
---|---|---|
ORDER_CREATED | When the order is created but the payment still not received. | AWAITING_PAYMENT_FROM_USER |
ORDER_PAYMENT_VERIFYING | When the user marks the payment as done but it is not received by us yet. | PAYMENT_DONE_MARKED_BY_USER |
ORDER_PROCESSING | When the payment is received and reconciled and we have initiated fiat transfer to the user. | PENDING_DELIVERY_FROM_TRANSAK |
ORDER_PROCESSING | When the crypto payment is received & fiat being transferred via our banking partner but because of some issue our system is unable to send the fiat to the user. | ON_HOLD_PENDING_DELIVERY_FROM_TRANSAK |
ORDER_COMPLETED | When we have received the crypto payment and fiat is sent successfully to the userβs bank account. | COMPLETED |
ORDER_FAILED | When the user failed to make the payment within the timeframe. | EXPIRED |
ORDER_FAILED | Due to third party failure. | FAILED |
ORDER_FAILED | When the user manually cancels the order. | CANCELLED |
Sample code
const jwt = require('jsonwebtoken');
Orders.transakWebhook = function (body, next) {
let accessToken = 'YOUR_ACCESS_TOKEN';
let decodedData = jwt.verify(body.data, accessToken);
...
};
Orders.remoteMethod('transakWebhook', {
description: 'Transak WebHook',
accepts: [{arg: 'data', type: 'object', required: true, http: {source: 'body'}}],
returns: {arg: 'response', type: 'object'},
http: {path: '/webhook', verb: 'post'},
});
Sample decrypted payload data
{
"eventID": "ORDER_CREATED",
"createdAt": "2020-02-17T01:55:05.100Z",
"webhookData": {
"id": "9151faa1-e69b-4a36-b959-3c4f894afb68",
"walletAddress": "0x86349020e9394b2BE1b1262531B0C3335fc32F20",
"createdAt": "2020-02-17T01:55:05.095Z",
"status": "AWAITING_PAYMENT_FROM_USER",
"fiatCurrency": "EUR",
"userId": "65317131-cd95-419a-a50c-747d142f83e9",
"cryptocurrency": "CDAI",
"isBuyOrSell": "BUY",
"fiatAmount": 1110,
"walletLink": "https://goerli.etherscan.io/address/0x86349020e9394b2BE1b1262531B0C3335fc32F20#tokentxns",
"amountPaid": 0,
"partnerOrderId": "2183721893",
"partnerCustomerId": "2183721893",
"redirectURL": "https://google.com",
"conversionPrice": 0.663847164368606,
"cryptoAmount": 731.34,
"totalFee": 5.52652764336864,
"paymentOptionId": "credit_debit_card",
"autoExpiresAt": "2020-02-16T19:55:05-07:00",
"referenceCode": 226056
}
}
Send the test webhook
Use Test Webhook to test your webhook integration.
Update your webhook URL
Use Update Webhook to update your webhook URL.
Updated about 2 months ago