Skip to main content

Invoices

An invoice on Skia is not an Order. It is a signed claim — an issuer-declared obligation — that resolves into Orders at payment time, settling through the existing commit/reveal rail. The claim layer lives on /v1 (eight paths); the settlement layer stays on /api, byte-identical.

The claim

The claim is an EIP-712 InvoiceClaim, signed by the issuer. The verifying implementation must hash exactly this canonical encodeType — the same byte-match discipline as the Order typehash:
Per EIP-712, string members hash to keccak256 of their UTF-8 bytes, and all members are always encoded — an absent externalRef encodes the empty string, so the digest is total. No dynamic-member omission.

The domain (D-INV-1)

The claim’s signature is anchored to the rail where it resolves. The program-constant-domain alternative was considered and rejected.

The claim hash

The identifier every countersignature references — pinned as the EIP-712 digest itself:

Roles

Signatures are role-bound: issuer and debtor are struct fields of the claim, so recovery proves the signing role.

The event taxonomy — nine kinds

Every state-changing act is a signature + an event. Events are append-only; corrections are new events, never edits.

Status is a pure fold

Status is never stored. It is recomputed at read time from the event list (property-tested: no unreachable states; overdue and partial are always derivable):
  • ISSUE → ISSUED
  • +ACK → ACKNOWLEDGED — the credit moment: an acknowledged invoice IS a receivable
  • + first RECEIPTED payment while outstanding is above zero → PARTIALLY_PAID
  • outstanding reaches zero → SETTLED (terminal)
  • +REJECT → REJECTED (terminal)
  • +VOID → VOIDED (terminal)
  • +DEFAULT → DEFAULTED (terminal)
VOID is refused once paidToDate > 0 (409 INVOICE_STATE_INVALID). A VOID after money moved would strand debtor funds on the out-of-band refund path. VOID stays a clean-withdrawal instrument for unpaid claims; moneyed claims unwind with credit notes (creditedToDate does not trip the guard).
DEFAULT is issuer-declared after grace — a reputation signal, NOT cryptographic proof of non-payment (the debtor may have paid on a rail outside the issuer’s view). Only valid after dueAt + gracePeriodSeconds, only from a non-terminal state with outstanding above zero. Decentralized default attestation is deferred to Phase 3.

The money law

Integer atomic-unit arithmetic only — floats never touch money on this surface.
  • outstanding = max(0, faceAmount − paidToDate − creditedToDate)
  • Payments reduce principal only. Credit notes reduce principal only. A note closing a dispute is a FLAG transition, never a second deduction.
  • Late fee — a non-compounding, read-time accrual on the undisputed remainder:
Whole days count from dueAt + gracePeriodSeconds (unix seconds, never block numbers). Fees never consume payments — the late fee is a computed number for reporting and policy, never a balance: it never increases outstanding and never reduces a payment.
  • Disputes supersede, never sum — the latest open DISPUTE’s amount is the whole open disputed amount; a derived RESOLVE zeroes it. Disputes are a flag on the remainder, not a payment blocker.
  • Once DEFAULTED, the fee clock freezes at the DEFAULT event’s recordedAt — terminals are absorbing; a post-DEFAULT payment shrinks the fee, never grows the clock.
  • Overage (paid + credited above face) surfaces as surplus and is settled out-of-band in Phase 1 (disclosed). Payments on VOIDED/REJECTED claims are recorded as events; refunds are out-of-band (no on-chain refund rail).

Two clocks

Reading the ledger

  • GET /v1/invoices/{invoiceId}/receivable — the fold view of one invoice (issuer or debtor only).
  • GET /v1/receivables — cursor-paginated fold views for the calling party (role, status, currency, settleChainId filters; limit up to 100).
The Receivable carries the fold state plus orthogonal flags (overdue, openDisputedAmount), the full event list (the audit trail is first-class), and the derived lateFeeAccrued.
The event ledger discloses two Phase-1 trust boundaries: the ack/reject decision word and disputedAmount are ledger-recorded rather than covered by signatures. Phase 2 binds decisions into signed structs alongside a negotiation-transcript protocol.
Active-chain rule: the Phase-1 invoice service operates exactly ONE active settlement chain at a time (X Layer at ship). A claim whose settleChainId differs is refused at issue with 400 INVOICE_CHAIN_NOT_ACTIVE. Payment attempts inherit the claim’s chain — there is no per-request cross-chain routing.

Where to next