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).

FieldTypeNotes
amountstring, requiredDecimal string, minimum "1.00".
currencystring, required"USDT" only.
order_idstring, requiredYour reference, up to 64 characters. Unique among open payments.
customer_emailstringShown on the receipt.
methodsarraybinance_pay, trc20, bep20, erc20, polygon. Default: every enabled wallet. A single method is pre-selected.
success_url / cancel_urlstringWhere the customer is sent afterwards. Never trust them for fulfilment.
webhook_urlstringOverrides the endpoint for this payment. Must be a public https URL.
expires_ininteger300–86400 seconds, default 1800.
metadataobjectUp 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

StatusMeaning
pendingWaiting for the customer to choose a method and pay.
confirmingTransfer seen, waiting for confirmations.
paidConfirmed. Fulfil the order.
underpaidLess than the amount due arrived on a per-payment address.
expiredNothing arrived before expires_at.
latePaid after expiry — the merchant approves it manually.
canceledCanceled.

Errors

Errors use the shape {"error": {"code", "message", "param"}}.

HTTPCodeWhen
400invalid_amountAmount missing, below 1.00 or not a decimal string.
400invalid_requestAny other invalid field (`param` tells which).
401invalid_api_keyMissing, malformed or revoked key.
403ip_not_allowedRequest IP is not on the account allow-list.
409duplicate_orderAn open payment already exists for this order_id.
422no_method_availableNone of the requested methods is enabled.
429rate_limitedMore than 50 requests per second for this key.