API Documentation
Integrate crypto payment acceptance into your application in minutes.
https://cryptopayment.center/api/v1
Overview
CryptoPayment is a crypto payment gateway that lets you accept BTC, LTC, ETH, USDT (TRC20) and USDT (BEP20) payments. Each payment generates a unique blockchain address — no shared wallets.
The typical flow:
1. Your backend calls POST /invoices → receives a unique address + checkout URL
2. Redirect your customer to the checkout URL (or display the address yourself)
3. Customer sends crypto to the address
4. We notify your webhook when payment is detected and confirmed
5. Funds appear in your merchant balanceAuthentication
All API requests require an Authorization header using your API key and secret:
Authorization: Bearer {api_key}:{api_secret}
Get your API credentials from the merchant dashboard after your account is approved.
Supported Networks
Create Invoice
Creates a new payment invoice and returns a unique deposit address.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
network | string | required | btc | ltc | eth | trc20 | bep20 |
amount_usd | float | required | Amount in USD (min: 1.00) |
order_id | string | optional | Your internal order reference |
metadata | object | optional | Any additional data (customer_id, etc.) |
Example Request
POST /api/v1/invoices
Authorization: Bearer pk_abc123:sk_xyz789
{
"network": "trc20",
"amount_usd": 50.00,
"order_id": "ORD-12345",
"metadata": { "customer_id": "usr_001" }
}
Response
{
"success": true,
"invoice": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"order_id": "ORD-12345",
"status": "pending",
"network": "trc20",
"network_label": "USDT (TRC20)",
"coin": "USDT",
"amount_usd": 50.00,
"amount_crypto": 50.00,
"address": "TXxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"paid_amount": 0,
"txid": null,
"confirmations": { "received": 0, "required": 19 },
"expires_at": "2024-01-15T10:30:00+00:00",
"created_at": "2024-01-15T10:00:00+00:00"
},
"checkout_url": "https://cryptopayment.center/pay/550e8400-..."
}
Get Invoice
Retrieve the current status of an invoice.
Invoice Status Values
| Status | Description |
|---|---|
pending | Waiting for payment. Customer hasn't sent funds yet. |
confirming | Payment detected on blockchain, waiting for confirmations. |
confirmed | Payment fully confirmed. Funds credited to your balance. |
expired | Invoice expired before payment was received (30 min default). |
List Invoices
Returns paginated list of your invoices (20 per page).
GET /api/v1/invoices?page=2Get Balances
{
"success": true,
"balances": {
"USDT-TRC20": { "available": 450.00, "pending": 0 },
"BTC": { "available": 0.025, "pending": 0 }
}
}
Request Withdrawal
Request a withdrawal to your external wallet. Requests over $500 require manual admin review.
| Coin | Minimum | Network Fee |
|---|---|---|
| BTC | 0.0005 | 0.00005 |
| LTC | 0.01 | 0.001 |
| ETH | 0.005 | 0.001 |
| USDT-TRC20 | 5 USDT | 1 USDT |
| USDT-BEP20 | 5 USDT | 0.5 USDT |
Example
POST /api/v1/withdrawals
{
"coin": "USDT-TRC20",
"amount": 100.00,
"address": "TXxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
Webhook Events
Set your webhook URL in the merchant dashboard under each API Key. Every API key can have its own webhook URL — useful when one merchant account is used across multiple systems (e.g. different servers or products). We send a POST request to that URL when invoice status changes.
{
"event": "payment.confirmed",
"invoice_id": "550e8400-...",
"order_id": "ORD-12345",
"status": "confirmed",
"network": "trc20",
"coin": "USDT",
"amount_usd": 50.00,
"amount_crypto": 50.00,
"paid_amount": 50.00,
"txid": "a1b2c3...",
"confirmations": 19,
"address": "TXxx...",
"timestamp": "2024-01-15T10:05:00+00:00",
"signature": "hmac-sha256-hash"
}
| Event | Description |
|---|---|
payment.detected | Transaction seen on blockchain, awaiting confirmations |
payment.confirmed | Required confirmations reached, funds credited to your balance |
We retry failed webhooks up to 5 times with exponential backoff (1min, 5min, 15min, 1h, 6h). Respond with HTTP 200 to acknowledge.
Verify Webhook Signature
Every webhook request includes a signature field. Verify it to ensure the request genuinely comes from CryptoPayment.center. Your APP_KEY is shown in the dashboard under API Keys.
// PHP — Full webhook handler example
$raw = file_get_contents('php://input');
$data = json_decode($raw, true);
$invoiceId = $data['invoice_id'] ?? '';
$event = $data['event'] ?? '';
$receivedSig = $data['signature'] ?? '';
// APP_KEY is base64-encoded — decode it first!
$appKey = base64_decode('YOUR_APP_KEY_BASE64');
$expected = hash_hmac('sha256', $invoiceId . '.' . $event, $appKey);
if (!hash_equals($expected, $receivedSig)) {
http_response_code(400);
exit('Invalid signature');
}
// Only process confirmed payments
if ($event === 'payment.confirmed' && $data['status'] === 'confirmed') {
$orderId = $data['order_id'];
$amountUsd = $data['amount_usd'];
// ... update your database here
}
http_response_code(200);
echo 'OK';
PHP Example
$apiKey = 'pk_your_key';
$apiSecret = 'sk_your_secret';
// Create invoice
$ch = curl_init('https://cryptopayment.center/api/v1/invoices');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey . ':' . $apiSecret,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'network' => 'trc20',
'amount_usd' => 50.00,
'order_id' => 'ORD-001',
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
if ($response['success']) {
$checkoutUrl = $response['checkout_url'];
// Redirect customer:
header('Location: ' . $checkoutUrl);
}
Node.js Example
const response = await fetch('https://cryptopayment.center/api/v1/invoices', {
method: 'POST',
headers: {
'Authorization': `Bearer pk_your_key:sk_your_secret`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
network: 'trc20',
amount_usd: 50.00,
order_id: 'ORD-001',
}),
});
const data = await response.json();
// Redirect to: data.checkout_url
Python Example
import requests
response = requests.post(
'https://cryptopayment.center/api/v1/invoices',
headers={
'Authorization': 'Bearer pk_your_key:sk_your_secret',
'Content-Type': 'application/json',
},
json={
'network': 'trc20',
'amount_usd': 50.00,
'order_id': 'ORD-001',
}
)
data = response.json()
checkout_url = data['checkout_url']