Skip to content

Add a machine-readable invoice payment request for agents - #13

Open
Kenbak wants to merge 2 commits into
mainfrom
new/agent-cipherpay-integration-6015c1
Open

Kenbak wants to merge 2 commits into
mainfrom
new/agent-cipherpay-integration-6015c1

Conversation

@Kenbak

@Kenbak Kenbak commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Adds GET /api/invoices/{id}/payment-request so agents and wallets can pay a checkout without scraping it.

  • Restates the stored ZIP-321 URI with integer zatoshis and decoded memos. The invoice output is required: true and uses the stored price_zatoshis; the URI amount must be within 1 zatoshi, and the address and memo must match. The optional FEE-<id> platform fee output is required: false, because the scanner bills the merchant when it's missing.
  • payable / not_payable_reason: only fresh, untouched pending invoices are payable. It refuses draft, expired, underpaid, already paid, refunded, cancelled and in-progress invoices, and invoices with a cross-chain attempt (accepts_payment can reject a direct transfer for those).
  • Lookup is by invoice ID only, not memo code. No shipping data, refund address or checkout token is exposed. The route has the public read rate limit, no-store and CORS *.

Companion PRs: web checkout discovery link, and Zipher's pay_invoice MCP tool.

Tests: cargo test --locked: 148 passed, 3 ignored. The new tests cover URI parsing, exact decimal amounts, refused shapes, every not-payable reason, and the handler against an in-memory SQLite database. No live invoice or payment was used.

🤖 Generated with Claude Code

kenbak wan and others added 2 commits November 25, 2026 08:05
GET /api/invoices/{id}/payment-request restates the stored ZIP-321 URI with
integer zatoshis and decoded memos, marks the invoice output required and the
platform fee output optional, and reports payable=false with a reason for
draft, expired, paid, underpaid, in-progress and cross-chain invoices, where
a direct transfer could be refused by the scanner. Lookup is by invoice ID
only; no shipping, refund address or checkout token is exposed.

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant