Sign inStart free

Crypto payments API and webhooks: a developer guide

For sellers ·

To accept crypto payments from your own code, create a payment with POST /api/v1/payments from your server, send your customer to the returned url and wait for the signed payment.paid webhook. The customer pays in BTC, USDC, USDT, ETH or SOL, the money goes straight to the merchant's wallet and Blokbay withholds 1%: the merchant receives 99%.

Coins and networks on your payment page

Your customer chooses the coin on the payment page. Today these are available:

  • BTC on Bitcoin, from 100 USD: two exact transfers from the customer's wallet, one of them straight to your Bitcoin address
  • USDC on Ethereum, Polygon, BNB Chain, Base, Arbitrum, and Solana
  • USDT on Ethereum, Polygon, BNB Chain, Arbitrum, and Solana
  • ETH on Ethereum, Base, and Arbitrum
  • SOL on Solana

Bitcoin appears only if you add a Bitcoin address in Settings. USDC/USDT/SOL on Solana appears only if you add a Solana address in Settings.

Gateway contract: 0xd4b637cC81D5B5115Cd0204A9ba6B60474F05e31 (Ethereum, Polygon, BNB Chain, Base, and Arbitrum)

Keys and rules of the API

In Payments on your site you create a secret key, sk_live_ followed by 48 hexadecimal characters, shown only once. Every request carries it as Authorization: Bearer sk_live_... The public key, pk_live_..., identifies your account in webhooks.

Call the API only from your server: requests sent by a browser, with an Origin header, are refused and there are no CORS headers. If a key leaks, create a new one: the old one stops working at once. Limits are 120 requests per minute per account and 30 payment creations per minute.

Create a payment

POST /api/v1/payments takes amount as a string with the decimals of the currency, currency among USD, EUR, GBP, CHF, JPY, CAD, AUD, SGD, HKD, and AED (USD by default), reference up to 100 characters, an optional description, url_success and url_cancel, and an optional customer_email. Send an Idempotency-Key header so that a retried request does not create a second payment.

The answer, 201, contains the id gp_..., the url of the payment page and expires_at: the customer has 24 hours to start paying. Payments start from 1 USD, Bitcoin from 100 USD.

From payment page to webhook

  1. Your server creates the payment and redirects the customer to url.
  2. The customer chooses the coin and pays from their wallet. The price in crypto is locked: 2 hours for stablecoins, 15 minutes for ETH, 3 hours for Bitcoin.
  3. Blokbay reads the payment on the blockchain: for stablecoins and ETH the event of the public contract with the right payment, wallet and amount; for Bitcoin both transfers with 2 confirmations.
  4. Blokbay sends payment.paid to your webhook URL and the customer returns to url_success with the payment id.
  5. Your server checks the signature, then marks the order as paid.

You can also read the status at any time with GET /api/v1/payments/:id or search by reference with GET /api/v1/payments?reference=... Statuses are pending, paid and expired.

Verify and process webhooks

Each webhook is a POST with a JSON body and the headers Blokbay-Event-Id, Blokbay-Event-Type and Blokbay-Signature. The signature has the form t=<seconds>,v1=<HMAC-SHA256 of t.body> computed with your webhook signing secret, whsec_...

Compare the signature in constant time and reject old timestamps. Answer with any 2xx within 10 seconds. Otherwise Blokbay retries after 1 minute, 5 minutes, 30 minutes, 2, 6, 12, 24 and 24 hours. The same event can arrive more than once, so process each event id only once.

Treat payment.paid as final: a payment that arrives after payment.expired is still recorded as paid, because the funds are already in the merchant's wallet. Check that the amount and the currency match your order before you ship.

Test with real money, safely

There is no sandbox with fake money, so that a test can never mark a real order as paid. From the dashboard you create a real payment of 1 USD to your own wallet and send a ping event to your webhook. On Polygon or Base the network fee is a few cents. The documentation has examples with curl and signature checks in Node and PHP.

Questions and answers

Is there a sandbox?
No. You test with a real payment of 1 USD to your own wallet and with the ping event from the dashboard, so tests never touch real orders.
Which data does the webhook contain?
The payment as returned by the API: id, status, amount and currency as created, the amount in USD, the exchange rate used and, when paid, network, coin and transaction. Internal data such as the fee is never included.
How do I avoid duplicate payments?
Send an Idempotency-Key header when you create a payment, and process each webhook event id only once.

You remain the seller: you are responsible for your website, your products and your obligations towards your customers, including invoices, delivery, refunds, taxes and the checks required in your country.

Start accepting crypto today

1% per payment, no fixed costs, funds go directly to your wallet, no approval needed.

Start free

Practical guides