How to Decrypt the Webhook Payload

Verify and decode the encrypted data field returned in Transak webhook events

View as Markdown

Transak sends the webhook payload in the data field as a signed JWT. To read the actual order or KYC payload, verify the JWT using your Partner Access Token and then decode its claims on your backend.

Before You Start

  • Your webhook endpoint must already be configured with Transak.
  • You need a valid Partner Access Token. Follow How to Create a Partner Access Token.
  • Perform verification and decoding only on your server. Do not expose the access token in frontend code.

Always verify the JWT signature before trusting any webhook data. Do not decode the payload without verification.

How It Works

When Transak sends a webhook, the payload includes an encrypted data field. Your backend should:

1

Receive the webhook request

Store the raw data field exactly as received from the webhook body.

2

Load your Partner Access Token

Use the Partner Access Token as the JWT signing secret.

3

Verify the JWT signature

Verify the webhook data field before processing it. Reject the request if signature validation fails.

4

Read the decoded claims

Once verified, parse the claims to access the original webhookData object and event details.

Code Samples

1

Install the dependency

NPM Package: jsonwebtoken

$npm install jsonwebtoken
2

Verify and decode the webhook payload

1import jwt from "jsonwebtoken";
2
3// JWT token received from the webhook response's data field
4const webhookData = "eyJhbGciOiJIU.eyJ3ZWJob29-rRGF0.W07q-JG6jlyzid4";
5
6// Your Access Token — used as the signing secret
7const accessToken = "ACCESS_TOKEN";
8
9// Verify and decode the JWT token
10const decodedData = jwt.verify(webhookData, accessToken);
11
12console.log(decodedData);

Sample Decrypted Payload

1{
2 "webhookData": {
3 "id": "181b6159-2192-4f68-8647-f48e6e8f58c7",
4 "walletAddress": "0xD902d7eBF7bcE",
5 "createdAt": "2024-08-23T10:33:09.426Z",
6 "status": "COMPLETED",
7 "fiatCurrency": "EUR",
8 "userId": "243a8ce2-9cc6-41a9-aaeb-b0deeb09a3",
9 "cryptoCurrency": "ETH",
10 "isBuyOrSell": "BUY",
11 "fiatAmount": 32,
12 "ipAddress": "35.177.158.9",
13 "amountPaid": 32,
14 "paymentOptionId": "sepa_bank_transfer",
15 "walletLink": "https://sepolia.etherscan.io/address/0xD902d7eBF7bcE",
16 "quoteId": "0b9edf4d-2de1-4f2e-bdb6-07bc61c380f5",
17 "orderProcessingType": "NORMAL",
18 "addressAdditionalData": false,
19 "network": "ethereum",
20 "conversionPrice": 0.00041416655266757863,
21 "cryptoAmount": 0.01211023,
22 "totalFeeInFiat": 2.76,
23 "fiatAmountInUsd": 35.57,
24 "countryCode": "IN",
25 "stateCode": "Karnataka",
26 "orderChannelType": "WIDGET",
27 "userKycType": "STANDARD",
28 "cardPaymentData": {
29 "orderId": "181b6159-2192-4f68-8647-f48e6e8f58c7",
30 "paymentId": "66c8656bb38a7908fadc77db",
31 "pgData": {
32 "paymentOptions": [
33 {
34 "currency": "EUR",
35 "id": "sepa_bank_transfer",
36 "name": "Bank Transfer Details",
37 "fields": [
38 { "name": "Bank Name", "value": "Transak Limited" },
39 { "name": "IBAN", "value": "GB69MOCK00000003743944" },
40 { "name": "Bank Name", "value": "Modulr" },
41 { "name": "Bank Address", "value": "Scale Space, 58 Wood Lane, London, W12 7RZ" }
42 ]
43 }
44 ],
45 "liquidityProvider": "MODULR",
46 "status": "CREATED"
47 },
48 "liquidityProvider": "MODULR",
49 "updatedAt": "2024-08-23T10:33:58.753Z",
50 "status": "CAPTURED",
51 "processedOn": "2024-08-23T10:33:57.000Z"
52 },
53 "statusHistories": [
54 {
55 "status": "PENDING_DELIVERY_FROM_TRANSAK",
56 "createdAt": "2024-08-23T10:33:59.408Z",
57 "message": "💸 Payment reconciled successfully. Received 32 EUR",
58 "isEmailSentToUser": false,
59 "partnerEventId": "ORDER_PROCESSING"
60 }
61 ],
62 "isFirstOrder": false,
63 "updatedAt": "2024-08-23T10:34:06.371Z",
64 "completedAt": "2024-08-23T10:34:39.412Z",
65 "transactionHash": "DUMMY_TX_ID",
66 "transactionLink": "https://sepolia.etherscan.io/tx/DUMMY_TX_ID",
67 "conversionPriceData": {
68 "id": "139474c7-99c5-4232-9a05-c6ccd6a973ed",
69 "createdAt": "2024-08-23T10:34:06.352Z",
70 "fiatCurrency": "EUR",
71 "cryptoCurrency": "ETH",
72 "paymentMethod": "sepa_bank_transfer",
73 "fiatAmount": 32,
74 "network": "ethereum",
75 "cryptoAmount": 0.01211023,
76 "isBuyOrSell": "BUY",
77 "conversionPrice": 0.00041416641727771563,
78 "marketConversionPrice": 0.00041628949369556297,
79 "slippage": 0.51,
80 "cryptoLiquidityProvider": "transak",
81 "fiatLiquidityProvider": "coinbase",
82 "partnerApiKey": "d79671a4-b021-4a4f-a444-6862a680a94b",
83 "sourceTokenAmount": 0.012110226041200406,
84 "sourceToken": "ETH",
85 "notes": [],
86 "fiatFeeAmount": 2.76,
87 "feeDecimal": 0.08625,
88 "swaps": [
89 {
90 "sourceCurrency": "EUR",
91 "destinationCurrency": "USDT",
92 "sourceAmount": 32,
93 "destinationAmount": 35.57563545494966,
94 "paymentMethod": "sepa_bank_transfer",
95 "liquidityProvider": "coinbase",
96 "conversionPrice": 1.111738607967177,
97 "feeInSourceAmount": 0,
98 "networkFeeInSourceAmount": 0,
99 "marketConversionPrice": 1.111738607967177,
100 "isNonCustodial": false,
101 "isFiatliquidityProvider": true,
102 "isFiatPartnerDirectCryptoDeposit": false,
103 "isFiatPartnerAccountWalletDeposit": false,
104 "liquidityProviderData": false,
105 "originalDestinationAmount": 35.57563545494966
106 },
107 {
108 "sourceCurrency": "USDT",
109 "destinationCurrency": "ETH",
110 "sourceAmount": 35.57563545494966,
111 "destinationAmount": 0.0132533253528869,
112 "liquidityProvider": "transak",
113 "conversionPrice": 0.0003725393849863884,
114 "networkFeeInSourceAmount": 0,
115 "networkFeeInDestinationAmount": 0,
116 "marketConversionPrice": 0.0003725393849863884,
117 "liquidityProviderData": false,
118 "isNonCustodial": false
119 },
120 {
121 "sourceCurrency": "ETH",
122 "destinationCurrency": "ETH",
123 "sourceAmount": 0.0132533253528869,
124 "destinationAmount": 0.0132533253528869,
125 "liquidityProvider": "transak",
126 "conversionPrice": 1,
127 "isCryptoliquidityProvider": true,
128 "networkFeeInSourceAmount": 0.000067651170404,
129 "networkFeeInDestinationAmount": 0.000067651170404,
130 "marketConversionPrice": 1,
131 "liquidityProviderData": false,
132 "isFiatPartnerAccountWalletDeposit": false
133 }
134 ],
135 "fees": [
136 {
137 "name": "Transak fee",
138 "value": 2.6,
139 "id": "transak_fee",
140 "ids": ["transak_fee", "partner_fee"]
141 },
142 {
143 "name": "Network/Exchange fee",
144 "value": 0.16,
145 "id": "network_fee",
146 "ids": ["network_fee"]
147 }
148 ],
149 "fiatAmountInUsd": 35.57,
150 "internalFees": [
151 { "name": "Network/Exchange fee", "id": "network_fee", "value": 0.16 },
152 { "name": "Transak fee", "id": "transak_fee", "value": 1 },
153 { "name": "Transak fee", "id": "partner_fee", "value": 1.6 }
154 ],
155 "cost": {
156 "ethPriceInLocalCurrency": 2402.17448469,
157 "gasCostinLocalCurrency": 0.16334786495892,
158 "transakMinimumFee": 1,
159 "transakFeeAmount": 1,
160 "fiatLiquidityProviderFee": 0,
161 "gasCostinLocalCurrencyByFiatPartner": 0,
162 "gasCostinLocalCurrencyByCryptoPartner": 0,
163 "partnerFeeDecimal": 0.05,
164 "partnerFeeInLocalCurrency": 1.6,
165 "totalFeeDecimal": 0.08625,
166 "totalFeeAmount": 2.76,
167 "gasCurrency": "ETH",
168 "gasInNativeToken": 0.000068,
169 "gasCurrencyRateInUsd": 0.0003744603090795391,
170 "totalAmountChargedByTransak": 2.76334786495892
171 }
172 },
173 "partnerFeeInLocalCurrency": 1.6
174 },
175 "eventID": "ORDER_COMPLETED",
176 "createdAt": "2024-08-23T10:34:40.070Z"
177}