Skip to main content
Document AI

How to Extract Receipt Data with Bitcoin Lightning

Turn any receipt, invoice, or financial document into structured JSON. Upload an image or PDF, pay 50 sats per page, and get back merchant details, line items, totals, tax, and category — all extracted and organized automatically.

50 sats/pageNo account requiredStructured JSON outputL402 / MCP / OpenClaw

For Humans

Use cases for individuals, freelancers, and businesses

Expense tracking without manual entry

Snap a photo of a receipt and get merchant, date, items, and total as structured data. Import directly into your spreadsheet or accounting software instead of typing everything by hand.

Tax preparation

Batch-process a year's worth of receipts into categorized, structured data. Categories like food, transport, and medical are detected automatically — so you can sort deductions without reading every receipt yourself.

Business expense reports

Photograph receipts during business trips and extract data immediately. No more keeping paper receipts in your wallet for weeks and hoping nothing fades before you get back to the office.

Audit trail for freelancers

Extract and archive invoice data from clients and vendors. Structured JSON is searchable, sortable, and exportable — unlike a folder of JPEGs that you have to open one by one to find anything.

Output Example

Upload a receipt image or PDF and get back structured JSON like this. The two-step process first extracts raw text via OCR, then an AI model parses it into a consistent schema.

receipt-ocr-output.json
{
  "merchant": {
    "name": "Corner Market & Deli",
    "address": "482 Main St, Austin, TX 78701",
    "phone": "(512) 555-0193",
    "website": null
  },
  "date": "2026-03-12",
  "time": "14:23",
  "items": [
    { "name": "Organic Whole Milk 1gal", "quantity": 1, "price": 5.49 },
    { "name": "Sourdough Bread", "quantity": 1, "price": 4.29 },
    { "name": "Avocado (3pk)", "quantity": 2, "price": 7.98 },
    { "name": "Black Bean Soup 15oz", "quantity": 3, "price": 8.97 }
  ],
  "subtotal": 26.73,
  "tax": 2.21,
  "taxRate": "8.25%",
  "tip": null,
  "total": 28.94,
  "currency": "USD",
  "paymentMethod": "Visa ***4821",
  "invoiceNumber": null,
  "category": "groceries"
}

How It Works

1
Go to sats4ai.com/receipt-ocrOpen the Receipt OCR tool in your browser.
2
Upload a receipt image or PDFSupports JPEG, PNG, WEBP, and multi-page PDFs.
3
Pay 50 sats per pageScan the Lightning QR with any wallet. Multi-page PDFs are charged per page.
4
Get structured JSON + raw textReceive merchant info, line items, totals, tax, category, and the raw OCR text.

For Agents

Use cases for AI agents, automation pipelines, and developers

No API key needed. Receipt OCR uses L402 — pay-per-page via Lightning. Agents send a document, receive a 402 with an invoice, pay it, and get structured JSON back. Process one receipt or a thousand with no quota management.

Automated expense processing

Email-to-expense pipeline: receipts arrive as attachments, the agent extracts structured data, categorizes spending, and pushes line items to your accounting system. No human touches the data between inbox and ledger.

Invoice reconciliation

Compare invoice data against purchase orders automatically. The agent extracts line items and totals from incoming invoices, matches them to POs, and flags discrepancies for review.

Financial document archival

Process incoming invoices and receipts into structured records for searchable storage. JSON records are trivial to index and query — eliminating the manual data entry bottleneck.

Receipt verification

Agents verify receipt totals by checking extracted itemized amounts against the stated total, flagging arithmetic errors or missing line items before reimbursement is approved.

L402 Authentication Flow

1
Send the request without authPOST the receipt image or PDF (base64-encoded) to the endpoint. The server responds with HTTP 402 and a Lightning invoice.
2
Pay the invoiceThe agent pays the 50-sat Lightning invoice (per page). Confirms in milliseconds.
3
Resend with payment proofResend the request with the payment preimage in the Authorization header. The server returns structured JSON with merchant, items, totals, and raw OCR text.
terminal
# Extract structured data from a receipt via Receipt OCR
# Step 1: Send request (returns 402 + invoice)
curl -X POST https://sats4ai.com/api/l402/receipt-ocr \
  -H "Content-Type: application/json" \
  -d '{"document":"<base64-encoded-image-or-pdf>"}'

# Step 2: Pay the Lightning invoice (50 sats/page)

# Step 3: Resend with payment proof
curl -X POST https://sats4ai.com/api/l402/receipt-ocr \
  -H "Content-Type: application/json" \
  -H "Authorization: L402 <token>:<preimage>" \
  -d '{"document":"<base64-encoded-image-or-pdf>"}'

MCP & OpenClaw

Chain with Other Services

Receipt OCR

Extract receipt data, then ask AI to summarize spending patterns, flag anomalies, or generate expense reports from the structured JSON.

Receipt OCR

Extract and format receipt data, then email a summary report to yourself, your accountant, or your team automatically.

Receipt OCR

For poor quality scans, run general OCR first to clean up and extract text, then Receipt OCR for structured field extraction.

Receipt OCR

Use image analysis to verify a receipt image is readable and properly oriented before sending it to Receipt OCR for data extraction.

Extract Receipt Data — No Signup Required

50 sats per page. Structured JSON output with merchant, items, totals, and category. All you need is a Lightning wallet.