Skip to content

Integration skill

If you integrate B4bit Pay with Claude Code, Claude Desktop, or Cursor, install the b4bit-pay-integrator skill. Claude recognizes the context (files like webhook.ts, X-Device-Id headers, XRP/XLM/ALGO symbols) and offers safe templates, HMAC signature diagnostics, and a complete go-live checklist.

Before implementing or updating an integration, read the changelog, starting with the latest entry, then the OpenAPI contract. The customer details change documented on 2026-11-04 is already available in production.

In addition to this guide, agents can use:

When implementing POST /orders/, apply these rules:

  1. full_name and country are optional when creating the order, including with input_currency.
  2. If either is missing, a successful response retains the other fields and omits address, payment_uri, and tag_memo. Do not expect HTTP 400 for missing payer details.
  3. If payment_uri exists, use it for the direct payment QR and display TAG/MEMO when provided.
  4. If payment_uri is absent, present web_url as a gateway link or QR. Currency, amount, status, or expiry do not establish that direct payment is available.
  5. Do not invent addresses, URIs, or customer details. Test both responses, including a selected currency with incomplete payer details.

See POST /orders/ for complete examples. Apply these rules even when using an older installed skill or MCP client.

When Claude detects you are working on code that touches B4bit Pay (through triggers like pos.b4bit.com, X-Device-Id, webhook HMAC, X-NONCE, payment_uri), it automatically activates this skill and applies:

  • Non-negotiable security rules: timing-safe HMAC comparison (crypto.timingSafeEqual / hmac.compare_digest / hash_equals), never ==.
  • Ready-made templates for webhook handlers in Node (Express), Python (Flask), PHP (Slim), Go (Gin), and Next.js (Route Handler) — all with correctly validated signatures.
  • Mapping of the 11 states (NR, PE, AC, IA, CO, CA, EX, OC, FA, DE, CM) to the 4-5 typical merchant states (pending / processing / cancelled / failed).
  • TAG/MEMO detection: if the flow uses XRP, XLM, or ALGO, Claude inserts the callout that makes tag_memo visible in the customer UI (omission = loss of funds).
  • Go-live checklist (11 items) executed before letting you mark the integration as ready.
  • HMAC mismatch diagnostics: if your signature does not match, the skill walks you through typical causes (bad secret decoding, reserialized body, wrong charset).
  1. Install the MCP server in your AI client (next section).

  2. Install the skill under ~/.claude/skills/:

    Ventana de terminal
    npx @b4bit/b4bit-pay-mcp install-skill

    This copies the b4bit-pay-integrator/ folder (templates, scripts, SKILL.md) to your personal skills directory.

  3. Restart Claude Code / Claude Desktop / Cursor and open a merchant project. The skill activates on its own when it detects triggers related to B4bit Pay.

The skill delegates operations like “verify this signature” or “list the currencies” to the MCP server. Add it to the client you use:

.mcp.json (raíz del proyecto)
{
"mcpServers": {
"b4bit-pay": {
"command": "npx",
"args": ["-y", "@b4bit/b4bit-pay-mcp"],
"env": { "B4BIT_API_KEY": "<tu-api-key>" }
}
}
}

The API key is obtained from Settings → Merchant → Devices (pay.b4bit.com/settings/commerce/devices).

Once installed, these requests activate the skill automatically:

  • “Integrate B4bit Pay into my Express app.” → Generates the webhook handler with timing-safe HMAC + an endpoint to create an order + handling for all 11 states.
  • “My webhook returns 401 invalid signature, what is wrong?” → Claude invokes the MCP’s verify_webhook with your actual nonce/body/signature and diagnoses the problem (secret decoded as base64 instead of hex, reserialized body, reversed concatenation…).
  • “What does status=AC with safe=true mean?” → Invokes map_status and returns the matching merchant state and whether it is safe to release the product.
  • “I want to add XRP as an input currency.” → Inserts the TAG/MEMO callout in the UI and validates that tag_memo renders as prominently as the address.
  • “Audit before production.” → Runs the go-live checklist on your repo and reports outstanding items.
ToolUse case
list_currenciesValidate the input symbol before creating the order.
create_orderDry-run or create a real order respecting all fields.
get_orderFetch the current state of a payment.
list_ordersReconciliation by date window.
verify_webhookReplay the HMAC and diagnose mismatches.
map_statusTranslate NR…CM into pending/processing/cancelled/failed.
probe_endpointArbitrary GET/POST against pos.b4bit.com (with dry-run).
list_endpointsQuick reference of the 5 public endpoints.
create_deviceCreate a device (requires explicit confirmation).

Confirm the skill is active:

Ventana de terminal
ls ~/.claude/skills/b4bit-pay-integrator/
# SKILL.md references/ scripts/ templates/

Then try in Claude: “What is the official test vector of the B4bit Pay webhook?” — it should respond with the vector from SKILL.md and offer to replay it via the MCP.