Docs / API reference / Create a payment
Create a payment
POST /v1/payments creates a payment and returns the hosted checkout URL.
Request
POST https://api.bit2pay.net/v1/payments · Authorization: Bearer sk_live_… · optional Idempotency-Key header (same key within 24 hours returns the original payment).
| Field | Type | Notes |
|---|---|---|
amount | string, required | Decimal string, minimum "1.00". |
currency | string, required | "USDT" only. |
order_id | string, required | Your reference, up to 64 characters. Unique among open payments. |
customer_email | string | Shown on the receipt. |
methods | array | binance_pay, trc20, bep20, erc20, polygon. Default: every enabled wallet. A single method is pre-selected. |
success_url / cancel_url | string | Where the customer is sent afterwards. Never trust them for fulfilment. |
webhook_url | string | Overrides the endpoint for this payment. Must be a public https URL. |
expires_in | integer | 300–86400 seconds, default 1800. |
metadata | object | Up to 20 string key/value pairs, echoed in webhooks. |
curl https://api.bit2pay.net/v1/payments \
-H "Authorization: Bearer sk_live_…" \
-H "Idempotency-Key: 7c1f0a52-order-1042" \
-H "Content-Type: application/json" \
-d '{
"amount": "25.00",
"currency": "USDT",
"order_id": "ORD-1042",
"customer_email": "buyer@example.com",
"success_url": "https://yourstore.com/thanks",
"metadata": {"user_id": "42"}
}'Response
{
"id": "pay_9f2c1a7e3b4d5e6f7a8b9c0d",
"object": "payment",
"status": "pending",
"amount": "25.00",
"currency": "USDT",
"order_id": "ORD-1042",
"checkout_url": "https://pay.bit2pay.net/checkout/6d2f…",
"pay_amount": null,
"expires_at": "2026-11-19T10:30:00Z",
"livemode": true,
"metadata": {"user_id": "42"}
}pay_amount is the exact amount the customer must send. It is null until a method is chosen, unless you passed a single entry in methods.
Retrieve payments
GET /v1/payments/{id} returns one payment. GET /v1/payments?order_id=ORD-1042 lists matches (also status and limit up to 100).
Statuses
| Status | Meaning |
|---|---|
pending | Waiting for the customer to choose a method and pay. |
confirming | Transfer seen, waiting for confirmations. |
paid | Confirmed. Fulfil the order. |
underpaid | Less than the amount due arrived on a per-payment address. |
expired | Nothing arrived before expires_at. |
late | Paid after expiry — the merchant approves it manually. |
canceled | Canceled. |
Errors
Errors use the shape {"error": {"code", "message", "param"}}.
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_amount | Amount missing, below 1.00 or not a decimal string. |
| 400 | invalid_request | Any other invalid field (`param` tells which). |
| 401 | invalid_api_key | Missing, malformed or revoked key. |
| 403 | ip_not_allowed | Request IP is not on the account allow-list. |
| 409 | duplicate_order | An open payment already exists for this order_id. |
| 422 | no_method_available | None of the requested methods is enabled. |
| 429 | rate_limited | More than 50 requests per second for this key. |