Fiber LogoFiber Docs
Payments

Invoice

How to create, send, and manage invoices in the Fiber network

This page is a work in progress. More detailed examples and advanced usage patterns will be added soon. For the protocol-level specification, see Invoice Protocol.

An invoice is a payment request generated by a recipient. It encodes all the information a sender needs to make a payment — the amount, the recipient's identity, and a cryptographic proof of payment.

What is an Invoice?

Think of an invoice as a "payment QR code." The recipient generates one, and the sender scans it (or copies the encoded string) to initiate a payment. The invoice contains:

  • Amount (optional — can be left open for donations)
  • Payment hash — a cryptographic commitment to a secret (preimage) that proves payment
  • Recipient's public key — identifies who should receive the payment
  • Expiry time — how long the invoice is valid
  • Description — a human-readable note (e.g., "Coffee")

Invoice Format

Fiber invoices use bech32m encoding (similar to Lightning's BOLT 11, but not compatible):

  • Mainnet prefix: fibb (fiber bytes, since 1 CKB = 1 Byte)
  • Testnet prefix: fibt
  • Dev prefix: fibd

Example: fibt100amount...encoded_data...signature

For the full encoding specification, see Invoice Protocol.

Creating an Invoice

Using fnn-cli

fnn-cli invoice new_invoice --amount 1000 --currency fibt --description "Test payment"

Using RPC

{
  "jsonrpc": "2.0",
  "method": "new_invoice",
  "params": [
    {
      "amount": "0x3E8",
      "currency": "fibt",
      "description": "Test payment",
      "expiry": 3600
    }
  ],
  "id": 1
}

Paying an Invoice

Using fnn-cli

fnn-cli payment send_payment --invoice "fibt1..."

Using RPC

{
  "jsonrpc": "2.0",
  "method": "send_payment",
  "params": [
    {
      "invoice": "fibt1..."
    }
  ],
  "id": 1
}

Invoice States

StateDescription
OpenThe invoice has been created but not yet paid
SettledPayment has been received and the preimage has been revealed
CancelledThe invoice has been manually cancelled or has expired
Accepted(Hold invoice only) Payment is in transit but not yet settled

Managing Invoices

ActionRPC Methodfnn-cli
Create invoicenew_invoicefnn-cli invoice new_invoice
Parse invoiceparse_invoicefnn-cli invoice parse_invoice
Get invoice statusget_invoicefnn-cli invoice get_invoice
Cancel invoicecancel_invoicefnn-cli invoice cancel_invoice
Settle invoice (hold)settle_invoicefnn-cli invoice settle_invoice

Fiber AI Assistant

Ask me anything

I can answer questions about Fiber Network using our documentation.

AI answers are based on Fiber documentation