POST /orders/
- Method:
POST - URL:
https://pos.b4bit.com/api/v1/orders/ - Content-Type:
application/json(recommended) ormultipart/form-data. - Authentication:
X-Device-Idheader.
Customer details and payment access
Section titled “Customer details and payment access”This contract is available in production. See the 2026-11-04 changelog for the change and required integration updates.
full_name (full name, up to 48 characters) and country (country of residence, a two-letter ISO 3166-1 code such as MX) are optional when creating an order, even when you send input_currency.
If either detail is missing, the API responds successfully with web_url and the remaining payment information, but omits address, payment_uri, and tag_memo. Missing payer details do not cause HTTP 400. The integrator must display the gateway link, or a QR encoding that link, so the customer can complete their details and continue payment.
With both valid payer details and a cryptocurrency, the API can provide blockchain data for direct payment. Choose the UI based on payment_uri, not on the presence of currency, amount, status, or expiry. Do not construct a blockchain address or crypto QR from other fields.
Fields
Section titled “Fields”Required
Section titled “Required”| Field | Type | Description |
|---|---|---|
expected_output_amount | number | Amount to charge, in the fiat currency. |
Main optional fields
Section titled “Main optional fields”| Field | Type | Default | Description |
|---|---|---|---|
input_currency | string | — | Crypto symbol (from GET /currencies). If omitted, the customer picks on the gateway. |
fiat | enum | MXN | MXN (default), USD, EUR, GBP, ARS, BRL, COP, CLP and 22 more. |
language | string | ES | Gateway language. |
notes | string (≤512) | — | Product/service description. |
reference | string (1-256) | — | Your internal ID. Key for idempotency — see idempotency. |
internal_data | string (1-1024) | — | Free-form merchant metadata. |
Redirects (Redirect Gateway)
Section titled “Redirects (Redirect Gateway)”| Field | Type | Description |
|---|---|---|
merchant_urlok | URI | Redirect after payment completed. |
merchant_urlko | URI | Redirect after payment not completed / expired. |
merchant_url_standby | URI | Redirect while awaiting confirmation. |
Customer personal data (optional)
Section titled “Customer personal data (optional)”See kyc-fields for the full detail.
full_name,email_client,phone_number,nif.home_address,address_number,address_additional,city,province,zip_code,country.
Examples — JSON (recommended)
Section titled “Examples — JSON (recommended)”curl -X POST \-H "X-Device-Id: $B4BIT_API_KEY" \-H "Content-Type: application/json" \-d '{ "expected_output_amount": 2500.00, "fiat": "MXN", "input_currency": "USDC_POLYGON_NXTB", "full_name": "María López", "country": "MX", "notes": "Pedido ORD-123", "reference": "ORD-123", "merchant_urlok": "https://tu-sitio.com/pago/ok", "merchant_urlko": "https://tu-sitio.com/pago/error"}' \https://pos.b4bit.com/api/v1/orders/import { fetch } from 'undici';
const res = await fetch('https://pos.b4bit.com/api/v1/orders/', {method: 'POST',headers: { 'X-Device-Id': process.env.B4BIT_API_KEY, 'Content-Type': 'application/json',},body: JSON.stringify({ expected_output_amount: 2500.00, fiat: 'MXN', input_currency: 'USDC_POLYGON_NXTB', full_name: 'María López', country: 'MX', notes: 'Pedido ORD-123', reference: 'ORD-123', merchant_urlok: 'https://tu-sitio.com/pago/ok', merchant_urlko: 'https://tu-sitio.com/pago/error',}),});const order = await res.json();import os, requests
r = requests.post( 'https://pos.b4bit.com/api/v1/orders/', headers={'X-Device-Id': os.environ['B4BIT_API_KEY']}, json={ 'expected_output_amount': 2500.00, 'fiat': 'MXN', 'input_currency': 'USDC_POLYGON_NXTB', 'full_name': 'María López', 'country': 'MX', 'notes': 'Pedido ORD-123', 'reference': 'ORD-123', 'merchant_urlok': 'https://tu-sitio.com/pago/ok', 'merchant_urlko': 'https://tu-sitio.com/pago/error', },)order = r.json()$body = json_encode([ 'expected_output_amount' => 2500.00, 'fiat' => 'MXN', 'input_currency' => 'USDC_POLYGON_NXTB', 'full_name' => 'María López', 'country' => 'MX', 'notes' => 'Pedido ORD-123', 'reference' => 'ORD-123', 'merchant_urlok' => 'https://tu-sitio.com/pago/ok', 'merchant_urlko' => 'https://tu-sitio.com/pago/error',]);
$ch = curl_init('https://pos.b4bit.com/api/v1/orders/');curl_setopt($ch, CURLOPT_POST, true);curl_setopt($ch, CURLOPT_POSTFIELDS, $body);curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'X-Device-Id: ' . getenv('B4BIT_API_KEY'), 'Content-Type: application/json',]);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);$order = json_decode(curl_exec($ch), true);Examples — multipart/form-data
Section titled “Examples — multipart/form-data”Historic alternative. Useful if your stack has poor JSON support or if you prefer to send all fields as string uniformly.
curl -X POST \-H "X-Device-Id: $B4BIT_API_KEY" \-F "expected_output_amount=2500.00" \-F "fiat=MXN" \-F "input_currency=USDC_POLYGON_NXTB" \-F "full_name=María López" \-F "country=MX" \-F "notes=Pedido ORD-123" \-F "reference=ORD-123" \-F "merchant_urlok=https://tu-sitio.com/pago/ok" \-F "merchant_urlko=https://tu-sitio.com/pago/error" \https://pos.b4bit.com/api/v1/orders/import { fetch, FormData } from 'undici';
const form = new FormData();form.append('expected_output_amount', '2500.00');form.append('fiat', 'MXN');form.append('input_currency', 'USDC_POLYGON_NXTB');form.append('full_name', 'María López');form.append('country', 'MX');form.append('notes', 'Pedido ORD-123');form.append('reference', 'ORD-123');form.append('merchant_urlok', 'https://tu-sitio.com/pago/ok');form.append('merchant_urlko', 'https://tu-sitio.com/pago/error');
const res = await fetch('https://pos.b4bit.com/api/v1/orders/', {method: 'POST',headers: { 'X-Device-Id': process.env.B4BIT_API_KEY },body: form,});const order = await res.json();import os, requests
r = requests.post( 'https://pos.b4bit.com/api/v1/orders/', headers={'X-Device-Id': os.environ['B4BIT_API_KEY']}, data={ 'expected_output_amount': '100.00', 'fiat': 'MXN', 'input_currency': 'USDC_POLYGON_NXTB', 'full_name': 'María López', 'country': 'MX', 'notes': 'Pedido ORD-123', 'reference': 'ORD-123', 'merchant_urlok': 'https://tu-sitio.com/pago/ok', 'merchant_urlko': 'https://tu-sitio.com/pago/error', },)order = r.json()200 response
Section titled “200 response”With cryptocurrency and complete payer details
Section titled “With cryptocurrency and complete payer details”{ "identifier": "1040095a-737d-41a2-a2e1-d031d19ec8cd", "reference": "ORD-123", "payment_uri": "ethereum:0x...?amount=...", "web_url": "https://pay.b4bit.com/...", "address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0b1f6", "tag_memo": null, "input_currency": "USDC_POLYGON_NXTB", "expected_input_amount": 100.00, "rate": 1.0, "notes": "Pedido ORD-123", "fiat": "MXN", "language": "ES"}When name or country of residence is missing
Section titled “When name or country of residence is missing”The response retains the other payment fields. In this example input_currency was sent, but address, payment_uri, and tag_memo are absent:
{ "identifier": "1040095a-737d-41a2-a2e1-d031d19ec8cd", "reference": "ORD-123", "web_url": "https://pay.b4bit.com/...", "input_currency": "USDC_POLYGON_NXTB", "expected_input_amount": 100.0, "rate": 1.0, "notes": "Pedido ORD-123", "fiat": "MXN", "language": "ES"}Rendering based on the response
Section titled “Rendering based on the response”This pseudocode uses the returned URI for a direct QR and the returned link for the gateway:
if (order.payment_uri) { renderCryptoPayment({ qrValue: order.payment_uri, address: order.address, amount: order.expected_input_amount, tagMemo: order.tag_memo, });} else { renderGatewayLink(order.web_url);}Errors
Section titled “Errors”403— Missing or invalidX-Device-Id.404— Invalid currency, amount below the minimum, missing URLs, or missing DNI image. See errors.429— Rate limit.500— Internal error.