API Integration
B4bit Pay exposes a small, focused REST API (5 endpoints) that covers the entire lifecycle of a crypto payment.
- Base URL:
https://pos.b4bit.com/api/v1 - Authentication:
X-Device-Idheader (the device API key) - Notifications: HMAC-SHA256 signed webhook on every state change
- Official Redoc:
https://pos.b4bit.com/redoc
See also the API Reference for endpoint-by-endpoint details.
Two integration modes
Section titled “Two integration modes”B4bit Pay supports two different flows. Choose the one that best fits your use case.
Redirect Gateway (online only)
Section titled “Redirect Gateway (online only)”You redirect the customer to the hosted B4bit Pay gateway. It is the simplest and fastest path to integrate.
Variant with input_currency:
- The merchant calls
GET /currenciesto learn the available options. - The merchant calls
POST /orders/withexpected_output_amount,input_currency, redirect URLs and description. - B4bit Pay responds with
web_url; your server redirects the customer there.
Variant without input_currency:
- The merchant only calls
POST /orders/with amount and URLs. - The customer chooses the currency directly on the B4bit Pay gateway.
- B4bit Pay returns
web_url; your server redirects.
API Gateway (online and offline)
Section titled “API Gateway (online and offline)”You display the payment data directly in your UI (typical in physical POS terminals).
- The merchant calls
POST /orders/withexpected_output_amount+input_currency. - B4bit Pay responds with
payment_uri,address,tag_memo,expected_input_amount,rate. - The merchant builds the QR code or displays the information on their screen.
- The customer pays from their wallet.
- B4bit Pay notifies the state change via webhook.
Quick example
Section titled “Quick example”curl -H "X-Device-Id: $B4BIT_API_KEY" \https://pos.b4bit.com/api/v1/currenciesimport { fetch } from 'undici';
const res = await fetch('https://pos.b4bit.com/api/v1/currencies', {headers: { 'X-Device-Id': process.env.B4BIT_API_KEY },});console.log(await res.json());import os, requests
res = requests.get( 'https://pos.b4bit.com/api/v1/currencies', headers={'X-Device-Id': os.environ['B4BIT_API_KEY']},)print(res.json())Mapping to your merchant states
Section titled “Mapping to your merchant states”The 11 B4bit Pay payment states can be summarized into 4 typical merchant states:
| B4bit Pay state | Merchant state |
|---|---|
NR / PE / AC with safe=false | Pending |
CO / AC with safe=true / CM | Processing (or Paid) |
CA / EX | Cancelled |
FA / OC / IA | Failed |
DE | Deleted |
The safe field indicates whether the payment already has one blockchain confirmation and it is safe to release the product/service.
Next steps
Section titled “Next steps” API Reference 5 endpoints with complete request/response.
Webhook HMAC-SHA256, X-NONCE, test vectors.
Quickstart 5-minute guide with examples.
Integration modes Redirect vs API Gateway in detail.