🌐 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 CodeDescriptionStatus Code
ORDER_PROCESSINGOrders in the PROCESSING state have passed the checks and the user's payment information has been validated.PROCESSING
ORDER_FAILEDWhen the user failed to make the payment within the timeframe.EXPIRED
ORDER_FAILEDWhen the order is failed because of the card decline.FAILED
ORDER_FAILEDWhen the user cancels the order.CANCELLED
ORDER_COMPLETEDWhen we have received the payment and the crypto is sent successfully to the user.COMPLETED
ORDER_PROCESSINGWhen the payment is received and being exchanged & transferred via us or our liquidity partner.PENDING_DELIVERY_FROM_TRANSAK
ORDER_PAYMENT_VERIFYINGWhen the user marks the payment as done but it is not received by us yet.PAYMENT_DONE_MARKED_BY_USER
ORDER_CREATEDWhen the order is created but the payment still not received.AWAITING_PAYMENT_FROM_USER
ORDER_REFUNDEDWhen fiat payment received from user is refunded back to the user's payment instrument as cryptocurrency could not be fulfilled due to some reason.REFUNDED

Off Ramp

WebSocket Event CodeDescriptionStatus Code
ORDER_CREATEDWhen the order is created but the payment still not received.AWAITING_PAYMENT_FROM_USER
ORDER_PAYMENT_VERIFYINGWhen the user marks the payment as done but it is not received by us yet.PAYMENT_DONE_MARKED_BY_USER
ORDER_PROCESSINGWhen the payment is received and reconciled and we have initiated fiat transfer to the user.PENDING_DELIVERY_FROM_TRANSAK
ORDER_PROCESSINGWhen 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_COMPLETEDWhen we have received the crypto payment and fiat is sent successfully to the user’s bank account.COMPLETED
ORDER_FAILEDWhen the user failed to make the payment within the timeframe.EXPIRED
ORDER_FAILEDDue to third party failure.FAILED
ORDER_FAILEDWhen the user manually cancels the order.CANCELLED
ORDER_REFUNDEDWhen cryptocurrency payment received from user is refunded back to the user's wallet as fiat payout could not be fulfilled due to some reason.REFUNDED

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.