Widget SDK

The CRYPTOMENTS Widget SDK is a JavaScript library that lets you embed a crypto payment UI into partner websites with minimal effort. Deposits, withdrawals, Axim Pay, payment links — all available as iframes or popups.

Doc version: 2.0 Last updated: March 30, 2026 CDN: https://widget.cryptoments.cc/sdk/widget.cryptoments.js

1 Overview

CryptoPaymentsWidget is a JavaScript SDK that lets you embed a crypto payment UI into partner websites with minimal effort.

💰 Deposit

Receive USDT on multiple blockchains

📤 Withdrawal

Send funds directly to a user's wallet

💳 Axim Pay

Pay quickly with an Axim wallet

🔗 Payment Links

Create and track dynamic payment links

⏰ Deposit Reservations

Manage recurring deposit schedules

🌐 Multi-chain

Supports BSC, Polygon, TRON

ℹ️
SDK Info
CDN URL: https://widget.cryptoments.cc/sdk/widget.cryptoments.js
Supported browsers: Chrome, Safari, Firefox, Edge (latest 2 versions)

Display Modes

The widget can be shown in two modes:

  • Modal: Overlay modal on top of the current page (recommended)
  • Window: Open in a new tab or popup window

2 Quick Start

Integrate the widget in three steps.

Step 1: Load the SDK

<script src="https://widget.cryptoments.cc/sdk/widget.cryptoments.js" type="module"></script>
<script type="module">
  window.CryptoPaymentsWidget = CryptoPaymentsWidget;
</script>

Step 2: Initialize

JavaScript
const widget = new CryptoPaymentsWidget({
  mode: 'window',        // 'window' | 'modal'
  widgetType: 'deposit', // 'deposit' | 'withdrawal' | 'connect'
  debug: false,
  onSuccess: (result) => console.log('Done:', result),
  onError: (error) => console.error('Error:', error),
  onClose: () => console.log('Widget closed')
});

Step 3: Open the Widget

JavaScript
// Open deposit widget
await widget.openDeposit('user_001');

// Open withdrawal widget
await widget.openWithdrawal('user_001');

// Connect wallet
await widget.openConnect('user_001');
Done! Your users can now deposit, withdraw, and connect their wallets through the widget.

3 Install & Authenticate

Client-side and server-side setup.

Client-Side

The SDK exposes a global window.CryptoPaymentsWidget object. No additional install step is required.

Server-Side — Generate Widget Tokens

For security, generate the widget auth token on your server and pass it to the client.

Node.js Example

JavaScript
const crypto = require('crypto');

const PARTNER_CONFIG = {
  apiKey: 'your_api_key',
  apiSecret: 'your_api_secret'
};

// Widget token issuance endpoint
app.post('/api/get-widget-token', async (req, res) => {
  const { partnerUserId, permissions } = req.body;
  // Timestamp (seconds)
  const timestamp = Math.floor(Date.now() / 1000).toString();

  // Signature: METHOD + PATH + TIMESTAMP
  const message = 'POST' + '/widgets/auth/token' + timestamp;
  const signature = crypto.createHmac('sha256', PARTNER_CONFIG.apiSecret)
    .update(message).digest('hex');

  const response = await fetch('https://api.cryptoments.cc/widgets/auth/token', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-API-KEY': PARTNER_CONFIG.apiKey,
      'X-TIMESTAMP': timestamp,
      'X-SIGNATURE': signature
    },
    body: JSON.stringify({
      partnerUserId,
      permissions: permissions || ['DEPOSIT_READ', 'WITHDRAWAL_REQUEST', 'BALANCE_READ']
    })
  });

  const tokenData = await response.json();
  res.json(tokenData);
});

Java/Spring Example

Java
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

@RestController
@RequestMapping("/api")
public class WidgetController {

    private static final String API_KEY = "your_api_key";
    private static final String API_SECRET = "your_api_secret";

    @PostMapping("/get-widget-token")
    public ResponseEntity<?> generateWidgetToken(@RequestBody WidgetTokenRequest req) throws Exception {
        // Timestamp (seconds)
        String timestamp = String.valueOf(System.currentTimeMillis() / 1000);

        // Signature: METHOD + PATH + TIMESTAMP
        String message = "POST" + "/widgets/auth/token" + timestamp;
        String signature = hmacSha256Hex(message, API_SECRET);

        String requestBody = "{\"partnerUserId\":\"" + req.getPartnerUserId() +
                            "\",\"permissions\":" + req.getPermissions() + "}";

        HttpRequest httpRequest = HttpRequest.newBuilder()
            .uri(URI.create("https://api.cryptoments.cc/widgets/auth/token"))
            .header("Content-Type", "application/json")
            .header("X-API-KEY", API_KEY)
            .header("X-TIMESTAMP", timestamp)
            .header("X-SIGNATURE", signature)
            .POST(HttpRequest.BodyPublishers.ofString(requestBody))
            .build();

        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(httpRequest, HttpResponse.BodyHandlers.ofString());

        return ResponseEntity.ok(response.body());
    }

    private String hmacSha256Hex(String message, String secret) {
        try {
            Mac mac = Mac.getInstance("HmacSHA256");
            mac.init(new SecretKeySpec(secret.getBytes(), "HmacSHA256"));
            byte[] bytes = mac.doFinal(message.getBytes());
            StringBuilder sb = new StringBuilder();
            for (byte b : bytes) sb.append(String.format("%02x", b));
            return sb.toString();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}

Using the Token in the Client

The SDK automatically requests the token from partnerApiUrl. You don't need to manage tokens yourself.

JavaScript
// SDK auto-issues the token when openDeposit/openWithdrawal/openConnect is called
const widget = new CryptoPaymentsWidget({
  partnerApiUrl: '/api/get-widget-token', // Server endpoint (default)
  mode: 'window',
  onSuccess: (result) => console.log('Done:', result)
});

// Token issuance + widget open handled automatically
await widget.openDeposit('user_001');

4 Configuration

All options you can pass to the widget constructor.

Option Type Required Default Description
Basic settings
mode string - 'window' 'window' or 'modal'
widgetType string - 'deposit' 'deposit', 'withdrawal', 'connect'
partnerApiUrl string - '/api/get-widget-token' Server endpoint that issues widget tokens
width number - 480 Widget width (pixels)
height number - 800 Widget height (pixels)
debug boolean - false Emit debug logs
Common options (constructor or open-time)
language string - 'ko' Widget UI language: 'ko' | 'en'
chainType string - null Pin chain: 'BSC', 'TRON', 'POLYGON'
presetAmount number - null Pre-fill amount
presetAmountCurrency string - 'USD' Currency unit for the amount
minAmount number - 10 Minimum amount
maxAmount number - 100000 Maximum amount
allowAmountEdit boolean - true Whether the user can edit the amount
fixedRateKrw number - null Fixed FX rate (KRW basis)
skipInput boolean - false Skip the amount-input screen
Deposit only
amountOptions number[] - [10000, 50000, 100000, 500000] Amount choices (KRW)
torqEnabled boolean - true Show the KRW Top-up (TORQ) payment card in the deposit widget. User tops up USDT via KRW bank transfer and then pays. Set false to hide it.
Withdrawal only
showBalance boolean - true Show balance
reqWithdraw function - null Withdrawal handler callback. Implement as async (data) => boolean (true: success, false: failure)
Callbacks
onSuccess function - - Success callback. result.type: 'deposit' | 'withdrawal' | 'connect' | 'axim_payment' | 'torq'
onError function - - Error callback. (error) => void
onClose function - - Widget-close callback

Configuration Example

JavaScript
const widget = new CryptoPaymentsWidget({
  // Basic settings
  mode: 'modal',
  widgetType: 'deposit',
  partnerApiUrl: '/api/get-widget-token',
  debug: false,

  // Common options
  language: 'ko',             // 'ko' | 'en' (default 'ko')
  chainType: 'BSC',
  presetAmount: 50000,
  presetAmountCurrency: 'KRW',
  minAmount: 10000,
  maxAmount: 500000,
  allowAmountEdit: true,
  skipInput: false,

  // Deposit only
  amountOptions: [10000, 50000, 100000, 500000],

  // Callbacks
  onSuccess: (result) => {
    if (result.type === 'deposit') {
      console.log(`Deposit complete: ${result.address} (${result.chainType})`);
    } else if (result.type === 'withdrawal') {
      console.log(`Withdrawal complete: TX ${result.transactionId}`);
    } else if (result.type === 'connect') {
      console.log(`Wallet connected: ${result.address}`);
    } else if (result.type === 'axim_payment') {
      console.log('Axim payment complete:', result);
    } else if (result.type === 'torq') {
      console.log(`KRW top-up (TORQ) complete: ${result.usdtAmount} USDT (escrowId: ${result.escrowId})`);
    }
  },
  onError: (error) => console.error('Error:', error.message),
  onClose: () => console.log('Widget closed')
});

5 Methods

Methods callable on a widget instance.

Method Parameters Returns Description
openDeposit(userId, options?) string, object Promise<void> Open the deposit widget. options follows the common/deposit fields in the Configuration table.
openWithdrawal(userId, options?) string, object Promise<void> Open the withdrawal widget. options follows the common/withdrawal fields in the Configuration table.
openConnect(userId, options?) string, object Promise<void> Open the wallet-connect widget.
close() - void Close the widget.
initialize(userId, permissions?) string, string[] Promise<boolean> Issue a token and initialize. Called automatically by the open methods.
addEventListener(type, callback) string, function void Register an event listener.
removeEventListener(type, id) string, string void Remove an event listener.

Method Usage Example

JavaScript
// Open deposit widget
await widget.openDeposit('user_001', {
  chainType: 'BSC',
  presetAmount: 50000,
  amountOptions: [10000, 50000, 100000]
});

// Open withdrawal widget
await widget.openWithdrawal('user_001', {
  showBalance: true,
  reqWithdraw: async (data) => {
    const res = await fetch('/api/process-withdrawal', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ withdrawalData: data })
    });
    return res.json();
  }
});

// Wallet-connect widget
await widget.openConnect('user_001');

// Close widget
widget.close();

6 Events

Subscribe to widget events to handle deposits, withdrawals, connection state, and more.

How to Use Events

Register events via addEventListener.

JavaScript
// Register an event listener
const listenerId = widget.addEventListener('depositCompleted', (event) => {
  console.log('Deposit complete:', event.data);
});

// Remove the listener
widget.removeEventListener('depositCompleted', listenerId);
ℹ️
Event callbacks receive an object shaped like { type, data, timestamp, stopPropagation, preventDefault }.

Event Flow

iframe (widget UI)
    ↓ postMessage
SDK (handleWidgetMessage)
    ↓
emit(event)
    ↓
addEventListener callback fires

Key Events

Event Description
Common
ready Widget ready
close Widget closed
error Error occurred
message Every message received (for debugging)
Deposit
depositCompleted Deposit complete
currencySelected Currency selected
networkSelected Network selected
addressGenerated Deposit address generated
transactionPending Deposit pending
transactionConfirmed Deposit confirmed
Withdrawal
withdrawalCompleted Withdrawal complete
balanceUpdated Balance updated
TORQ (KRW Top-up)
torqTopupCompleted KRW top-up complete (when TORQ is chosen as the deposit method). data: { escrowId, usdtAmount, txHash }
Axim (V2)
aximEnabled Axim enabled
aximConnectionStatus Connection status changed
aximConnectionRequested Connection requested
aximConnectionSuccess Connected
aximConnectionFailed Connection failed
aximPaymentRequested Payment requested
aximPaymentSuccess Payment success
aximPaymentFailed Payment failed
aximDisconnected Disconnected

Real-world Example

JavaScript
// Handle deposit completion
widget.addEventListener('depositCompleted', (e) => {
  console.log('Deposit complete:', e.data);

  // Persist on server
  fetch('/api/deposit-complete', {
    method: 'POST',
    body: JSON.stringify(e.data)
  });
});

// Withdrawal complete
widget.addEventListener('withdrawalCompleted', (e) => {
  console.log('Withdrawal complete:', e.data);
});

// TORQ top-up complete
widget.addEventListener('torqTopupCompleted', (e) => {
  console.log('TORQ top-up complete:', e.data.usdtAmount, 'USDT');
});

// Axim payment success
widget.addEventListener('aximPaymentSuccess', (e) => {
  console.log('Axim payment success:', e.data);
});

// Error handling
widget.addEventListener('error', (e) => {
  console.error('Error:', e.data);
});

7 Views Guide

Screen flows per widget type and the features of each view.

Deposit

The widget where users deposit USDT. The user picks a payment method (Axim Pay / Direct crypto deposit / KRW Top-up TORQ), receives a deposit address, and sends.

JavaScript
await widget.openDeposit('user_001', {
  // Amount
  presetAmount: 50000,              // Preset amount
  presetAmountCurrency: 'KRW',      // preset unit: 'KRW' | 'USD' (default 'USD')
  minAmount: 10,                    // Minimum amount (USDT basis, default 10)
  maxAmount: 100000,               // Maximum amount (USDT basis, default 100000)
  allowAmountEdit: true,           // Allow manual amount edit (default true)
  amountOptions: [10000, 50000, 100000], // Quick amount buttons (KRW)
  fixedRateKrw: 1400,              // Fixed FX rate (defaults to live rate if unset)

  // Network
  chainType: 'BSC',               // Pin network (defaults to user choice if unset)

  // UX
  skipInput: false,               // true: skip the amount-input screen (presetAmount required)

  // Payment method
  torqEnabled: true,              // Show the KRW Top-up (TORQ) payment card (default true)

});

Deposit Flow Overview:

Enter amount Choose payment method [ Axim Pay ] App connect & proceed Success/Failure
Enter amount Choose payment method [ Direct crypto payment ] Pick network + address Awaiting deposit
Enter amount Choose payment method [ KRW Top-up ] App connect & KYC check Quote Bank transfer / Contact transfer Awaiting verification Success/Failure/Dispute

Axim Pay

Enter amount Choose payment method [ Axim Pay ] App connect & proceed Success/Failure
Amount input screen

① Enter Amount

The first screen, where the user enters the KRW amount to deposit. The USDT amount is computed from the exchange rate.

  • KRW ↔ USDT two-way input (changing one auto-updates the other)
  • Live rate (1 USDT = N KRW)
  • Quick amount buttons shown when amountOptions is set
  • Min/max amount guide (from API or parameters)
  • If allowAmountEdit: false, the amount input is disabled
  • With presetAmount + skipInput: true, this screen is skipped
Payment method screen

② Choose Payment Method

The screen where the user picks a payment method.

  • Axim Pay (recommended): pay via the Axim Wallet app, no gas fees
    Shown only when aximEnabled: true
  • Direct crypto payment: send directly from a personal wallet or exchange
  • KRW Top-up (TORQ): top up USDT via KRW bank transfer, then pay
    Shown when torqEnabled: true (default). Requires a KRW amount input (minimum 10,000 KRW)
Payment method screen 2
Fixed Amount Mode skipInput + presetAmount
  • If skipInput: true and presetAmount is valid, the amount card is shown together
  • The [ ① Enter Amount ] screen is skipped and this screen is shown instead
  • If amount is not set (skipInput: true, no presetAmount), the button is disabled and an error is shown
Axim Pay app connect screen

③ Axim Pay App Connect

After picking Axim Pay, the screen varies by user environment.

  • Mobile: "Please confirm in the Axim Wallet app" — the app launches automatically; the screen advances on approval
  • Desktop: QR code shown — scan with the Axim Wallet app and approve
  • If Axim Wallet is not installed, the "About Axim Pay" link opens the install guide
Axim Pay payment request

④ Axim Pay Payment Request

The screen where the user confirms the amount and network, then sends a payment request to the Axim Wallet app.

  • Shows the amount (KRW/USDT) and the applied rate
  • Payment network dropdown (chain can be changed)
  • Clicking "Request Payment" sends a payment notification to the Axim Wallet app
  • "Change Payment Method" returns to the previous step
Payment completion screen

⑤ Axim Pay Awaiting Approval / Result

After sending the payment notification, the widget waits for the user's approval and transitions to success/failure based on the result.

  • Awaits approval after sending the payment notification (axim-wallet-confirm)
  • Success: "Payment complete", auto-closes
  • Failure/Rejected: shows reason, "Retry" button
  • "Open in app" deep-link button (mobile); "Cancel Payment" stops the payment

Events:

  • aximPaymentSuccess: fired on approval in the app
  • aximPaymentFailed: fired on rejection or timeout
  • depositCompleted: fired on final deposit completion

Direct Crypto Payment

Enter amount Choose payment method [ Direct crypto payment ] Pick network + address Awaiting deposit
Network + deposit address screen

Pick Network + Deposit Address

When the user picks Direct Crypto Payment, this screen shows the network choice and the deposit address.

  • Currency button (currently fixed to USDT)
  • Network dropdown (supported chains — BSC, TRON, Polygon, ...)
  • After picking a network, click "Show Deposit Address" → QR code + address text
  • Address copy button
  • If a deposit was reserved, a countdown is shown (expired notice on timeout)
  • Warning shown at the bottom about network mismatch
  • The chainType parameter can pin the network

Events:

  • depositCompleted: final deposit completion

KRW Top-up Payment

Enter amount Choose payment method [ KRW Top-up ] App connect & KYC check Quote Bank transfer / Contact transfer Awaiting verification Success/Failure/Dispute

The deposit branch entered when the user picks KRW Top-up on the payment method screen. The user tops up USDT via KRW bank transfer and the payment completes. This payment method is exposed via the torqEnabled option.

Axim Pay app connect screen

① Axim Pay App Connect

After picking Axim Pay, the screen varies by user environment.

  • Mobile: "Please confirm in the Axim Wallet app" — the app launches automatically; the screen advances on approval
  • Desktop: QR code shown — scan with the Axim Wallet app and approve
  • If Axim Wallet is not installed, the "About Axim Pay" link opens the install guide
Axim KYC check

② Axim KYC Check

Checks the KYC status inside Axim Wallet.

  • Settings → My Info → Verify
  • The verification status is polled; the screen advances automatically once complete.
Quote screen

③ Quote

Shows the exchange rate, fee, and resulting USDT for the entered KRW amount.

  • Live KRW ↔ USDT conversion, applied rate and premium
  • Minimum 10,000 KRW (LaaS host limit) — quotes below this are rejected
  • The KRW amount entered on the deposit widget is passed through to the quote step
Contact transfer

④ Transfer Instructions

The seller (LP) information is displayed; the user sends KRW to the indicated account / contact.

  • Bank transfer: send to the displayed bank/account/holder
  • Contact transfer: in the displayed bank app, send via phone-number-based contact transfer (phone copy / contact save provided)
  • Transfer deadline countdown (on expiry before transfer, an expired notice with "Retry" is shown)
Transfer report / awaiting verification

⑤ Report Transfer → Awaiting Verification

When the user clicks "Transfer Complete", the widget waits for the LP's deposit confirmation.

  • Once the LP confirms the deposit, the flow auto-completes
  • If the deadline passes after the transfer report, the screen transitions to dispute reporting (the user who sent funds is not expired)
  • Complete: the topped-up USDT amount, escrowId, and txHash are shown; the torqTopupCompleted event fires
Dispute screen

Dispute

  • Dispute: submit evidence (transfer record) → awaiting review screen

Withdrawal

The widget where the user requests a USDT withdrawal to an external wallet. Withdrawals are processed after partner-side approval.

JavaScript
await widget.openWithdrawal('user_001', {
  // Amount
  presetAmount: 50000,              // Preset amount
  presetAmountCurrency: 'KRW',      // preset unit: 'KRW' | 'USD' (default 'USD')
  minAmount: 10,                    // Minimum amount (USDT basis, default 10)
  maxAmount: 100000,               // Maximum amount (USDT basis, default 100000)
  allowAmountEdit: true,           // Allow manual amount edit (default true)
  fixedRateKrw: 1400,              // Fixed FX rate (defaults to live rate if unset)

  // Network
  chainType: 'BSC',               // Pin network (defaults to user choice if unset)

  // UX
  skipInput: false,               // true: skip the amount input (presetAmount required)
  showBalance: true,              // Show available balance (default true)

  // Withdrawal request callback (required)
  reqWithdraw: async (data) => {
    // data: { userId, chainType, currencyType, toAddress, amountCrypto, amountKrw, exchangeRate }
    const res = await fetch('/api/withdraw', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(data)
    });
    const result = await res.json();
    return result.success === true;  // return true on success, false/throw to show the failure screen
  }
});
⚠️
The reqWithdraw callback is required. Without it, the widget will not open.
Returning true → success screen + onSuccess callback. Returning false or throwing → failure screen.

Screen Flow:

Choose withdrawal method [ Axim Wallet ] App connect (if not yet) Enter withdrawal info Success/Failure
Choose withdrawal method [ Standard withdrawal ] Enter withdrawal info Success/Failure
Withdrawal method screen

① Choose Withdrawal Method

The first screen, where the user picks a withdrawal method.

  • Axim Wallet (recommended): withdraw to the address linked to the Axim wallet, no gas fees
    Shown only when aximEnabled: true
  • Standard withdrawal: enter a personal wallet address and withdraw
Withdrawal method screen 2
Fixed Amount Mode skipInput + presetAmount
  • If skipInput: true and presetAmount is valid, the amount card is shown together
  • If amount is not set (skipInput: true, no presetAmount), the button is disabled and an error is shown
Axim Pay app connect screen

② Axim Wallet App Connect

Shown only if Axim Wallet is not yet connected. Once connected, the flow advances to the withdrawal-info screen automatically.

  • Mobile: the Axim Wallet app launches automatically → approve the connection in-app
  • Desktop: QR code shown → scan with the Axim Wallet app and approve
  • If already connected, this screen is skipped and the flow goes straight to the withdrawal-info screen
  • If the app is not installed, the "About Axim Wallet" link opens the install guide
Withdrawal info screen

③ Axim Withdrawal Info

The withdrawal screen shown after Axim Wallet is connected. The connected wallet address is pre-filled.

  • An "Axim connected" badge is shown at the top
  • Based on the network choice, the Axim wallet address auto-fills (read-only)
  • KRW / USDT amount input (two-way conversion)
  • Min/max amount and available balance shown (when showBalance: true)
  • Clicking "Withdraw" invokes the reqWithdraw callback
Withdrawal info screen

④ Standard Withdrawal Info

The screen for entering a withdrawal destination address and amount when Standard Withdrawal is picked.

  • Currency button (fixed to USDT)
  • Network dropdown
  • Recipient address input (address format validation)
  • KRW / USDT amount input (two-way conversion)
  • Min/max amount and available balance shown (when showBalance: true)
  • Warning at the bottom about loss-of-funds risk on address/network mismatch
  • Clicking "Withdraw" invokes the reqWithdraw callback
Withdrawal method screen 2
Fixed Amount Mode skipInput + presetAmount
  • If skipInput: true and presetAmount is valid, the amount card is shown.
Withdrawal result screen

⑤ Withdrawal Success / Failure

The result screen for the withdrawal request, determined by the reqWithdraw callback's return value.

  • Success (returned true): "Your withdrawal request was submitted", auto-closes, onSuccess callback fires
  • Failure (returned false or threw): shows the failure reason, "Retry" button
  • Withdrawals are not processed instantly — they go through partner-side approval before broadcast (the request is in "received" state)

Wallet Connect

The widget for connecting Axim Wallet to the partner account. Once connected, Axim Pay/Wallet payments and withdrawals become available.

JavaScript
await widget.openConnect('user_001');

Screen Flow:

Awaiting app confirmation Connected
Axim Wallet connect request

① Awaiting Connection Approval

The screen that sends a connect request to the Axim Wallet app and waits for the user's approval.

  • Mobile: the Axim Wallet app launches automatically and shows a connect-request notification
  • Desktop: QR code shown — scan with the app and approve
  • If the app is not installed, the QR scan offers an app-store redirect
  • On approval, the screen advances to the connection-complete view automatically
  • The aximConnectionRequested event fires when the request is sent
Connection complete screen

② Connection Success / Failure

The Axim Wallet connection result screen.

  • Success: "Connected successfully", auto-closes, aximConnectionSuccess event fires
  • Failure: shows the failure notice, "Retry" button, aximConnectionFailed event fires
  • "Go back now" button closes immediately
  • After a successful connection, the Axim Pay/Wallet options are enabled in the deposit/withdrawal widgets

Events: the following events are emitted by the Axim SDK.

  • aximConnectionRequested: connection request sent
  • aximConnectionSuccess: connection succeeded (after which checkAximConnectionStatus updates automatically)
  • aximConnectionFailed: connection failed

8 Error Handling

How to handle errors raised by the widget.

How to Receive Errors

Errors can be received in two ways.

  • onError callback
  • error event listener
JavaScript
// 1. onError callback
const widget = new CryptoPaymentsWidget({
  ...config,
  onError: (error) => {
    console.error('Widget Error:', error);
  }
});

// 2. Event listener
widget.addEventListener('error', (event) => {
  console.error('Widget Error:', event.data);
});

Error Object Shape

Errors are delivered with the following shape.

JavaScript
{
  "message": "Error message"
}

Common Error Codes

Code Description Resolution
INVALID_TOKEN Token is invalid or expired Prompt the user to retry
NETWORK_ERROR Network request failed Retry or check connectivity
TIMEOUT Request timed out Retry after a short delay
INSUFFICIENT_BALANCE Insufficient balance Prompt the user to top up
UNKNOWN_ERROR Unknown error Check logs and contact support

Basic Error Handling Example

JavaScript
const widget = new CryptoPaymentsWidget({
  ...config,

  onError: (error) => {
    const message = error?.message || 'An error occurred.';
    console.log(message);
  }
});

Retry Handling

Transient issues like network errors can be resolved with retries.

JavaScript
async function openDepositWithRetry(userId, retry = 2) {
  try {
    await widget.openDeposit(userId);
  } catch (error) {
    if (retry > 0) {
      console.log('Retrying...', retry);
      setTimeout(() => {
        openDepositWithRetry(userId, retry - 1);
      }, 2000);
    } else {
      console.error('Final failure:', error);
    }
  }
}
⚠️
The SDK manages tokens automatically. You don't need to implement a token-refresh path of your own.

9 FAQ & Troubleshooting

Common issues and how to resolve them.

The widget doesn't open

  1. Verify the SDK loaded successfully
  2. Verify the CryptoPaymentsWidget object exists
  3. Check the browser console (F12) for errors
  4. Verify the partnerApiUrl server is responding normally

Events don't fire

  1. Verify the listener is registered via addEventListener
  2. Verify the event name is correct (case-sensitive)
  3. Verify the listener is registered before opening the widget
  4. Inspect the full flow via the message event
JavaScript
// For debugging (see all events)
widget.addEventListener('message', (e) => {
  console.log('EVENT:', e);
});

Token-related errors

  1. Verify the server's partnerApiUrl endpoint is operating correctly
  2. Verify the API Key / Secret are correct
  3. Verify the server time is accurate (to avoid timestamp errors)
ℹ️
The SDK requests and manages tokens automatically. You don't need to handle tokens manually on the client.

CORS errors

  1. Verify the current domain is in the allowed Whitelist
  2. Verify the protocol is included (https://)
  3. After configuration changes, allow some propagation time

Deposits aren't being detected

  1. Verify you sent on the correct network (chain)
  2. Verify the deposit address is correct
  3. Verify the amount meets the minimum
  4. Allow on-chain confirmation time (typically 1–5 minutes)

Withdrawals fail

  1. Verify reqWithdraw is implemented
  2. Verify your server API is responding normally
  3. Verify the balance is sufficient
  4. Verify the wallet address is correct

KRW Top-up (TORQ) doesn't proceed

  1. If the "KRW Top-up" card isn't visible in the payment methods, verify that openDeposit's torqEnabled option is not false (default true)
  2. If the card is disabled (un-clickable), verify a KRW amount has been entered — the card requires an amount to be active
  3. When the quote step looks like a "CORS error": it's usually not actually CORS but a 502 from upstream because the amount is below the 10,000 KRW minimum. Enter 10,000 KRW or more.
  4. If "Verifying" persists after reporting a transfer, you're waiting for the seller (LP) to confirm the deposit (test transfers don't actually arrive and won't complete)
⚠️
Additional Support
Need more help? Contact us at [email protected].