Idempotency
The reference field
Section titled “The reference field”B4bit Pay does not expose a standard Idempotency-Key header, but it offers a functional equivalent: the reference field on POST /orders/.
- Type: string.
- Length: 1-256 characters.
- Scope: you choose the format and uniqueness.
Recommendations
Section titled “Recommendations”- Use your internal order ID as
reference. For example, if your e-commerce generates orders likeORD-2026-04-17-000123, pass it as is. - Guarantee uniqueness: if you retry
POST /orders/after a timeout, you should not create a duplicate order in your system. Control retries with a local table and a singlereferenceper attempt. - Persist the returned
identifieralongside yourreferencefor bidirectional lookups. - Recommended format: UUID v4 or
{type}-{date}-{id}-{random}(for exampleORD-20260417-000123-ab34).
Reconciliation
Section titled “Reconciliation”When you receive a webhook, use it to locate your internal order by reference:
// pseudocódigoasync function handleWebhook(body) { const order = await db.orders.findOne({ b4bit_identifier: body.identifier }); if (!order) { // no debería pasar si persistió `reference` + `identifier` al crear. logger.warn('Webhook de orden desconocida', { identifier: body.identifier }); return; } await db.orders.updateStatus(order.id, body.status, body);}What NOT to use as reference
Section titled “What NOT to use as reference”- Customer email (not unique per order).
- The amount (not unique per order).
- A timestamp in seconds with no other factor (collisions are easy under load).