Documentation
Everything you need to integrate USDT payments into your application.
Quick Start
Get up and running with USDT payments in three steps.
1. Register and Get Your API Keys
Create an account at /auth/register. You'll get both a test and live API key.
# Test mode (for development)
Authorization: Bearer test_abc123...
# Live mode (for production)
Authorization: Bearer live_xyz789...
2. Add Your Wallet Address
In your dashboard, add a USDT wallet address for each network you want to accept. Payments will go directly to these addresses.
T... (34 chars)
0x... (42 chars)
0x... (42 chars)
3. Create Your First Invoice
Make a POST request to create an invoice. Use test_ key to simulate payments in sandbox mode.
curl -X POST https://api.example.com/api/v1/invoices \
-H "Authorization: Bearer test_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"reference": "ORDER-001",
"assetCode": "USDT_TRC20",
"amountUsdt": 100.0000,
"callbackUrl": "https://your-site.com/webhook"
}'
Authentication
API requests are authenticated using your API key sent in the Authorization header. You'll have two API keys:
Test API Key
test_abc123...
Use for development. Payments can be simulated via sandbox API.
Live API Key
live_xyz789...
Use for production. Real blockchain transactions only.
Keep Your API Keys Secret
Your API keys grant full access to your account. Never commit them to version control, expose them in client-side code, or share them publicly.
Invoices
An invoice represents a payment request. Create an invoice when your customer is ready to pay.
Invoice Lifecycle
Pending
Awaiting payment
Confirmed
Payment received
Expired
No payment before expiry
Exact Match System
Our gateway uses exact matching to confirm payments. All four conditions must be met:
Webhooks
When a payment is confirmed, expired, or cancelled, we send a POST request with payment details.
Webhook URL Priority
Important: There are two ways to configure webhook URLs:
- Per-Invoice (callbackUrl) - Set when creating an invoice. Takes priority.
- Global (Settings) - Configured in your dashboard settings. Used as fallback.
If you specify a callbackUrl when creating an invoice,
that URL will be used instead of the webhook URL in your settings.
Webhook Payload
{
"invoice_reference": "ORDER-001",
"merchant_id": "uuid",
"status": "confirmed",
"asset_code": "USDT_TRC20",
"payout_address": "TXyz...",
"amount_usdt_exact": "100.0000",
"tx_hash": "abc123...",
"metadata": { "orderId": "123" },
"paid_at": "2024-01-15T14:32:00Z"
}
Signature Verification
const crypto = require('crypto');
function verifySignature(body, signature, secret) {
const expected = crypto
.createHmac('sha256', secret)
.update(JSON.stringify(body))
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}
// Usage
const signature = req.headers['x-webhook-signature'];
const isValid = verifySignature(req.body, signature, webhookSecret);
if (!isValid) {
return res.status(401).send('Invalid signature');
}
Create Invoice
/api/v1/invoices
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
amountUsdt |
number | Yes | Amount in USDT (min: 0.0001, max 4 decimals) |
assetCode |
enum | Yes | USDT_TRC20, USDT_ERC20, or USDT_BSC |
reference |
string | No | Unique order reference (max 50 chars). Auto-generated if not provided. |
callbackUrl |
string | No | Per-invoice webhook URL (max 500 chars) |
expirySeconds |
number | No | Invoice validity: 300-7200 seconds (default: 1800) |
metadata |
object | No | Custom JSON data returned in webhook |
walletId |
string | No | Specific wallet ID (uses default wallet if not provided) |
title |
string | No | Invoice title shown on payment page (max 200 chars). E.g., "Order #12345" |
description |
string | No | Invoice description shown on payment page (max 500 chars) |
White Label Options
Enable white labeling to build your own custom payment UI instead of using our hosted checkout.
| Parameter | Type | Description |
|---|---|---|
useWhiteLabel |
boolean | Set to true to receive extra data for custom UI |
returnUrl |
string | URL to redirect after payment (max 500 chars) |
White Label Response
When useWhiteLabel: true, the response includes extra fields:
"whiteLabel": {
"cancelUrl": "https://...",
"statusUrl": "https://...",
"qrData": "TXyz123...",
"network": "tron",
"networkLabel": "Tron (TRC20)",
"title": "Order #12345",
"description": "Premium subscription"
}
Error Codes
| Code | Description |
|---|---|
200 |
Success |
201 |
Created |
400 |
Bad Request - Invalid parameters |
401 |
Unauthorized - Invalid API key |
403 |
Forbidden - Account suspended |
404 |
Not Found |
409 |
Conflict - Duplicate reference |
429 |
Too Many Requests - Rate limited |
500 |
Internal Server Error |
Supported Networks
USDT_TRC20
Tron Network
- Address: T... (34 chars)
- Confirmations: 20
- Avg. time: ~60 seconds
USDT_ERC20
Ethereum Network
- Address: 0x... (42 chars)
- Confirmations: 12
- Avg. time: ~3 minutes
USDT_BSC
Binance Smart Chain
- Address: 0x... (42 chars)
- Confirmations: 15
- Avg. time: ~45 seconds
Cancel Invoice
/api/v1/invoices/:id/cancel
Cancel a pending invoice. Only invoices with pending status can be cancelled.
curl -X POST https://api.example.com/api/v1/invoices/{invoice_id}/cancel \
-H "Authorization: Bearer test_your_api_key"
Note
Cancelling an invoice will trigger a webhook notification with status cancelled
if a callback URL is configured.
White Labeling
Build your own payment experience using our API. Instead of redirecting customers to our hosted payment page, you can create a fully branded checkout flow on your own domain.
How It Works
Key Fields for Custom UI
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"reference": "ORDER-12345",
"assetCode": "USDT_TRC20",
"payoutAddress": "TXyz123...abc456", // Display & QR code
"amountUsdtExact": "150.0000", // Exact amount to pay
"status": "pending",
"expiresAt": "2024-01-15T15:00:00Z", // Countdown timer
"createdAt": "2024-01-15T14:30:00Z"
}
Status Polling
// Poll every 5-10 seconds until status changes
GET /api/v1/invoices/:id
// Check response.status:
"pending" → Keep polling, show countdown
"confirmed" → Payment received! Show success
"expired" → Invoice expired, offer retry
"cancelled" → Invoice was cancelled
Full Customization
Use your own branding, colors, and domain. Your customers never see our interface.
Generate QR codes client-side using libraries like qrcode.js.
Sandbox Mode
Test your integration without real blockchain transactions using sandbox mode.
Test vs Live API Keys
Test API Key
test_abc123...
Creates invoices in sandbox mode. Use the simulate payment endpoint to test.
Live API Key
live_xyz789...
Creates real invoices. Monitors actual blockchain transactions.
Simulate Payment
In sandbox mode, use the simulate endpoint to mark an invoice as paid:
POST /api/v1/sandbox/invoices/:id/simulate-payment
Authorization: Bearer test_your_api_key
// Response
{
"success": true,
"message": "Payment simulated successfully",
"invoice": {
"id": "...",
"status": "confirmed",
"txHash": "sandbox_tx_abc123..."
}
}
Sandbox Webhooks
Webhooks are sent for sandbox invoices just like live invoices. Your test webhook URL will receive the same payload format, allowing you to fully test your webhook handling.
Best Practices
Store API Keys Securely
Never commit API keys to version control. Use environment variables and secrets management.
Use Idempotent References
Use unique, meaningful references (like order IDs) to prevent duplicate invoices and enable easy reconciliation.
Always Verify Webhook Signatures
Use timing-safe comparison when verifying HMAC signatures to prevent timing attacks.
Handle Webhooks Idempotently
Webhooks may be retried. Design your handler to safely process the same event multiple times.
Test Thoroughly in Sandbox
Test all scenarios including successful payments, expired invoices, and webhook handling before going live.