All articles

Journal

Crypto payment API in three calls: create an invoice, check the status, read the balance

The CryBit merchant API in plain words: authentication, the fields of an invoice, statuses, sandbox mode and what to do when the customer pays.

  • API
  • Developers
Crypto payment API in three calls: create an invoice, check the status, read the balance

The merchant API has three methods. You create an invoice, read its status and read your balance. The customer pays on the payment page, and you find out through a webhook or by asking for the status.

Authentication

Every request carries two headers: X-Public-Key and X-Private-Key. The public key identifies the merchant, so you do not send a shop id in the body. The private key is shown once when it is issued; if you lose it, reissue it and the old one stops working at once. The limit is 60 requests per minute.

The three API calls: create invoice, customer pays on the payment page, webhook or status request, read balance

Create an invoice

Send POST /api/v1/payments with amount and currency. The amount starts at 0.01, and the currency can be fiat, such as RUB, USD, EUR, CNY, GBP, CHF, JPY or KZT, or USDT and USDC. Useful optional fields are order_id (your own number, up to 80 characters), purpose (a description), ttl_minutes (lifetime from 5 to 1440, 30 by default), return_url (where to send the customer after payment), and crypto with network if you already know how the customer will pay.

The response contains the payment page link in callback_url. Send the customer there. If you passed crypto and network, the response also contains the address, the amount to send and a QR code.

Statuses

An invoice is waiting, paid, expired or cancelled. After the customer chooses a network the object also has the address, the coin and the fee. After payment it has status paid, the transaction id and the time. A waiting invoice that has passed its lifetime becomes expired the next time you ask for it.

Balance

GET /api/v1/wallet returns the available and the frozen USDT balance. One balance serves all merchants of the account. Test payments never touch it.

Test before you go live

A merchant in test mode creates sandbox invoices. The payment page has a button to mark an invoice as paid, and your balance is not credited. Switch the merchant to live to accept real transfers.

The full reference with examples in curl, JavaScript and PHP is on the developers page.

Accept crypto, receive USDT

Create a merchant, issue an invoice, try the sandbox. Live accepting opens after review.

More from the journal