The server signs the invoice
Creating an order returns a per-order reference keypair and an expiry slot. The server then signs a fixed 127-byte message — the prefix khaata:pay_invoice:v1, then the fields below — with the platform cashier key. That signature is an attestation: Khaata is stating, in a form the program can check, “this is the invoice I created.”
| Field | Type | Why it matters |
|---|---|---|
| merchant | pubkey | Whose invoice this is — and whose payout address receives it. |
| order_id | bytes16 | The order reference. Binds the ledger row to the settlement. |
| expected_amount | u64 | Base units. The customer can neither underpay nor overpay. |
| fee_bps | u16 | Must equal the merchant's on-chain fee, or the program rejects it. |
| expiry_slot | u64 | A slot deadline. On-chain — not a database timestamp. |
| reference | pubkey | The per-order PDA. One invoice, one account. |
| tip_amount | u64 | Optional; splits to the same payout address as the sale. |