Billify API

Integrate Billify invoicing into your app

Authentication

Create a Billify API key in Settings → API & Integrations. Send it on every request:

Authorization: Bearer bfy_your_api_key

Keys start with bfy_ followed by 32 hexadecimal characters. API access is included in the Business and Enterprise plans.

AI agents (MCP)

Billify is a remote MCP server, so assistants like Claude can list, read and create invoices, check crypto payments and fetch Invoice Passports. Endpoint (Streamable HTTP):

https://billify.org/mcp

Two ways in: from ChatGPT, Claude or Grok, add https://billify.org/mcp as a custom connector and sign in with your Billify account (OAuth 2.1, any plan, your plan limits apply; disconnect any time in Settings → API & Integrations); or send Authorization: Bearer bfy_… with an API key (Business and Enterprise).

Tools: list_invoices, get_invoice, create_invoice (pass an idempotency_key), send_invoice, create_credit_note, check_payment, get_approval, check_compliance, lookup_company (ANAF / VIES), get_efactura_xml (RO e-Factura, with ANAF validation), get_invoice_passport. Example client configuration:

{
  "mcpServers": {
    "billify": {
      "type": "http",
      "url": "https://billify.org/mcp",
      "headers": { "Authorization": "Bearer bfy_your_api_key" }
    }
  }
}

Paying agents (public MCP)

A second, public MCP server lets any agent look up a Billify invoice from its link, check who the seller is, and pay it with x402 (USDC on Base). No API key: the payment itself is the authorization.

https://billify.org/mcp/pay

Tools: get_invoice, verify_seller, pay_invoice (send the signed x402 payment in _meta["x402/payment"]), confirm_delivery.

The seller records what was delivered in the app or with declare_delivery on the account MCP server. After paying, confirm_delivery records accepted or disputed for that delivery, by its record_hash. Add an EIP-191 signature from the wallet that paid and the decision is recorded as proven by the payer; without it, only as made by someone holding the invoice link. Both appear with the hash in the Invoice Passport history, and a decision fires an invoice.delivery_accepted or invoice.delivery_disputed webhook.

Over plain HTTP, every payable invoice answers 402 with both an x402 offer (PAYMENT-REQUIRED) and a Machine Payments Protocol challenge (WWW-Authenticate: Payment, method evm, intent charge). For MPP, send the exact USDC amount on Base, then retry with Authorization: Payment and a hash credential; the answer carries a Payment-Receipt.

Private requests over Anyone

Agents can read, pay and verify invoices without revealing their IP address by sending their requests through a local Anyone client (SOCKS5h on port 9050). x402 and MPP payments need no account or key, so nothing ties the agent to a login either. The open-source invoice-passport library has anyoneFetch() and a full example.

npx @anyone-protocol/anyone-client
curl --socks5-hostname 127.0.0.1:9050 https://billify.org/mcp/pay \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

Invoice Passport

Every invoice has a machine-readable passport: the invoice, both parties, the payment evidence (on-chain transaction hash or Stripe ids) and its history, signed by Billify (ES256 JWS). Anyone with the invoice's public link can fetch and verify it.

GET https://brrstlblwhnfyirwcgoh.supabase.co
/functions/v1/invoice-passport?token=<public invoice token>
GET https://brrstlblwhnfyirwcgoh.supabase.co
/functions/v1/invoice-passport?jwks=1   # public keys to verify proof.jws

Create invoice

POST https://brrstlblwhnfyirwcgoh.supabase.co /functions/v1/api-create-invoice

Request body (JSON):

{
  "client_email": "client@example.com",
  "client_name": "Client Name",
  "amount": 100,
  "currency": "USD",
  "description": "Subscription to Opsion Pro",
  "due_days": 7
}

Billify creates the invoice and returns its public page in pay_link. Your client pays there by bank transfer, to your own wallet (set it in Settings), or through your payment link. Billify never holds the money.

Example response:

{
  "invoice_id": "uuid",
  "pay_link": "https://billify.org/invoice/…",
  "public_token": "uuid",
  "amount": 100,
  "currency": "USD",
  "due_date": "2026-04-14",
  "status": "sent"
}

Safe retries

Send an Idempotency-Key header (any unique string, up to 255 characters) to retry a request safely: repeating it with the same key and body returns the first response (with Idempotent-Replayed: true) instead of creating a second invoice. Reusing a key with a different body returns 422.

Webhooks

When an invoice is marked paid (for example a stablecoin payment to your wallet, matched on-chain), we notify your server. Set your Webhook URL under API & Integrations. We send a POST with Content-Type: application/json.

Example payload:

{
  "event": "invoice.paid",
  "invoice_id": "uuid",
  "public_token": "uuid",
  "amount_paid": 100,
  "currency": "USDT",
  "paid_at": "2026-04-07T10:00:00Z",
  "payment_method": "crypto",
  "payment_reference": "5325073644"
}

Verifying signatures

Every request carries Billify-Signature: t=<unix seconds>,v1=<hex>. v1 is the HMAC-SHA256 of `${t}.${rawBody}` keyed with the signing secret shown under API & Integrations. Reject requests whose signature doesn't match or whose t is more than 5 minutes old.

import crypto from "node:crypto";

function verifyBillify(rawBody, header, secret) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  const expected = crypto.createHmac("sha256", secret)
    .update(`${parts.t}.${rawBody}`).digest("hex");
  const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
  return fresh && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}