WebSockets

Receive real-time order updates on your server without polling.

View as Markdown

Transak uses WebSockets to push real-time order updates to your server and sends event data continuously over a live connection to ensure faster updates.

Transak WebSockets are powered by Pusher Channels. Use the Pusher client library for your platform, as a plain WebSocket client is not compatible.

Pusher App Key: 1d9ffac87de599c61283 | Cluster: ap2

When to Use?

Use CaseChannelHow to track
Track a single order in your frontendPublicBy Order ID
Track a specific order using your own referencePublicBy API Key + partnerOrderId
Track all orders server-sidePrivateEncrypted, backend only

Channels

ChannelChannel NameDescription
Receive order updates using the order ID${END_CUSTOMER_ORDER_ID}Public channel: Track an order by entering the order ID in the channel name.
Receive order updates using your API Key and partnerOrderId${API_KEY}_${partnerOrderId}Public channel: Track an order using your API key and your own order reference (partnerOrderId). Generate a unique order ID and pass it as the partnerOrderId query parameter before opening the widget.
Receive all order updates using your API Key & Access Token${API_KEY}Private channel: Track all orders using your API_KEY & ACCESS_TOKEN. The payload is encrypted - decrypt it with your ACCESS_TOKEN using the jsonwebtoken npm library.

For the private channel stream, ensure the WebSocket connection is handled by your backend application, as exposing it on the client side may compromise your Access Token.

Events

WebSocket Event CodeStatusDescription
ORDER_CREATEDAWAITING_PAYMENT_FROM_USERWhen the order has been created but the payment has not yet been received.
ORDER_PAYMENT_VERIFYINGPAYMENT_DONE_MARKED_BY_USERWhen the user marks the payment as done but Transak has not yet received it.
ORDER_PROCESSINGPROCESSINGOrders in the PROCESSING state have passed checks and the user’s payment information has been validated.
ORDER_PROCESSINGPENDING_DELIVERY_FROM_TRANSAKWhen the payment is received and being exchanged & transferred via Transak or a liquidity partner.
ORDER_COMPLETEDCOMPLETEDWhen Transak has received the payment and the crypto has been sent successfully to the user.
ORDER_FAILEDEXPIREDWhen the user failed to make the payment within the timeframe.
ORDER_FAILEDFAILEDWhen the order failed because the card was declined.
ORDER_FAILEDCANCELLEDWhen the user cancels the order.

Integration

Select your framework, then choose a channel type to get started.

1

Install Dependency

$npm install pusher-js
2

Subscribe to a Channel

1import { useEffect } from 'react';
2import Pusher, { Channel } from 'pusher-js';
3
4function App() {
5 const transakOrderId: string = 'TRANSAK_ORDER_ID'; // Replace with your Transak Order ID
6
7 useEffect(() => {
8 const pusher: Pusher = new Pusher('1d9ffac87de599c61283', {
9 cluster: 'ap2',
10 });
11
12 const orderChannel: Channel = pusher.subscribe(transakOrderId);
13
14 orderChannel.bind('ORDER_COMPLETED', (data: any) => {
15 console.log(`${transakOrderId} ORDER_COMPLETED:`, data);
16 });
17
18 return () => {
19 orderChannel.unbind_all();
20 pusher.unsubscribe(transakOrderId);
21 pusher.disconnect();
22 };
23 }, []);
24
25 return <div>{/* Your UI */}</div>;
26}
27
28export default App;

Sample Response

A typical event payload received on any channel looks like this:

1{
2 "event": "ORDER_CREATED",
3 "data": {
4 "id": "aa39d8e1-…-ce7f",
5 "walletAddress": "0xD902…BEFeE",
6 "createdAt": "2025-04-04T13:11:47.260Z",
7 "status": "AWAITING_PAYMENT_FROM_USER",
8 "fiatCurrency": "EUR",
9 "userId": "243a8ce2-…-b19a3",
10 "cryptoCurrency": "ETH",
11 "isBuyOrSell": "BUY",
12 "fiatAmount": 30,
13 "ipAddress": "14.142.***.***",
14 "amountPaid": 0,
15 "paymentOptionId": "sepa_bank_transfer",
16 "walletLink": "https://sepolia.etherscan.io/address/0xD902…BEFeE",
17 "quoteId": "9291a8bc-…-04e85",
18 "orderProcessingType": "NORMAL",
19 "addressAdditionalData": false,
20 "network": "ethereum",
21 "conversionPrice": 0.0006130127560164107,
22 "cryptoAmount": 0.01759347,
23 "totalFeeInFiat": 1.3,
24 "fiatAmountInUsd": 33.05,
25 "countryCode": "IN",
26 "partnerOrderId": "partner-order-id",
27 "stateCode": "Karnataka",
28 "orderChannelType": "WIDGET",
29 "tokenContractAddress": "0x0000…0000",
30 "userKycType": "STANDARD",
31 "updatedAt": "2025-04-04T13:11:48.374Z",
32 "cardPaymentData": {},
33 "conversionPriceData": {},
34 "partnerFeeInLocalCurrency": 0.3,
35 "statusHistories": []
36 }
37}