G

Receipt Schema

Receipt Schema

Canonical receipt format for all Gao Payment settlements — the public, verifiable record of every transaction.


Overview

Every settlement in Gao Payment — successful, failed, or timed out — produces exactly one canonical receipt. Receipts are the authoritative audit record of the payment layer.

Receipts are:

  • Cryptographically signed by the Payment layer runtime

  • Written to the append-only receipt ledger with verifiable on-chain anchoring

  • Publicly queryable via SDK and Gao Workspace

  • Immutable after emission — no amendment or deletion

  • Referenced by GAR v1 receipts (Layer 8) when settlement is part of an agent execution


Receipt Schema v1.1

{  
  "receipt_id": "rcpt_pay_abc123",  
  "schema_version": "1.1",  
  "runtime_version": "GP/1.1",  
  "status": "settled",  
  
  "intent": {  
    "intent_id": "pi_abc123",  
    "idempotency_key": "order-12345-payment",  
    "created_at": "2026-03-01T10:00:00Z",  
    "authorized_at": "2026-03-01T10:01:15Z",  
    "settled_at": "2026-03-01T10:01:42Z"  
  },  
  
  "parties": {  
    "payer_domain": "alice.gao",  
    "payee_domain": "shop.gao",  
    "payer_address": "0xPAYER...",  
    "payee_address": "0xPAYEE..."  
  },  
  
  "settlement": {  
    "amount": "25.00",  
    "currency": "USDC",  
    "network": "base",  
    "tx_hash": "0xTXHASH...",  
    "block_number": 19823401,  
    "confirmation_depth": 1,  
    "finality_mode": "optimistic"  
  },  
  
  "authorization": {  
    "cap_token_id": "cap_pay_abc123",  
    "risk_tier": 1,  
    "authorization_path": "auto_approved",  
    "policy_hash": "0xPOLICYHASH...",  
    "policy_version": "acme.gao:payment-policy:v2"  
  },  
  
  "fees": {  
    "network_fee": "0.001",  
    "network_fee_currency": "ETH",  
    "protocol_fee": "0.025",  
    "protocol_fee_currency": "USDC",  
    "merchant_fee": "0.00",  
    "total_deducted": "0.025",  
    "total_deducted_currency": "USDC"  
  },  
  
  "commerce": {  
    "order_ref": "order-12345",  
    "initiated_by": "seal:order-processor",  
    "fulfillment_triggered": true  
  },  
  
  "metadata": {  
    "initiated_by": "seal:order-processor",  
    "user_note": ""  
  },  
  
  "signature": "0xSIGNATURE...",  
  "anchored_at": "2026-03-01T10:01:45Z",  
  "anchor_tx_hash": "0xANCHOR..."  
}

---

### Field Reference

#### Top-Level

Field

Type

Description

`receipt_id`

string

Globally unique receipt identifier — `rcpt_pay_` prefix

`schema_version`

string

Receipt schema version (current: `1.1`)

`runtime_version`

string

Payment layer version that produced this receipt

`status`

enum

`settled`

#### Intent Block

Field

Description

`intent_id`

Reference to the originating payment intent

`idempotency_key`

Caller-provided deduplication key

`created_at`

Intent creation timestamp

`authorized_at`

User signature timestamp (null for rejected intents)

`settled_at`

On-chain confirmation timestamp (null for non-settled)

#### Parties Block

Field

Description

`payer_domain`

Gao Domain of the payer

`payee_domain`

Gao Domain of the payee

`payer_address`

On-chain wallet address of payer

`payee_address`

On-chain wallet address of payee

#### Settlement Block

Field

Description

`amount`

Amount settled (net of fees)

`currency`

Settlement currency

`network`

Settlement network (e.g., `base`, `polygon`)

`tx_hash`

On-chain transaction hash

`block_number`

Block number of settlement confirmation

`confirmation_depth`

Number of confirmations at receipt emission

`finality_mode`

`optimistic` (Tier 01)

#### Authorization Block

Field

Description

`cap_token_id`

CAP token used to authorize this payment

`risk_tier`

Assigned risk tier (03)

`authorization_path`

`auto_approved`

`policy_hash`

Hash of the domain policy snapshot at validation time

`policy_version`

Human-readable policy version reference

#### Fees Block

All fee fields are present on every receipt. Zero-value fees are recorded as `"0.00"` — they are not omitted.

Field

Description

`network_fee`

Gas/network fee paid

`protocol_fee`

Gao protocol fee (bounded by governance; may be zero)

`merchant_fee`

Merchant-defined fee (if applicable)

`total_deducted`

Sum of all deductions in settlement currency

#### Anchor Block

Field

Description

`signature`

Payment runtime signature over the full receipt payload

`anchored_at`

Timestamp of ledger write

`anchor_tx_hash`

On-chain anchor transaction hash (verifiable independently)

---

### Failure Receipt

Failed intents also emit receipts. The schema is identical with the following differences:

{  
  "status": "rejected",  
  "settlement": null,  
  "authorization": {  
    "cap_token_id": "cap_pay_abc123",  
    "risk_tier": 1,  
    "authorization_path": null  
  },  
  "failure": {  
    "error_code": "PAY_003",  
    "error_message": "Intent amount exceeds CAP settlement ceiling",  
    "failed_at": "2026-03-01T10:00:01Z",  
    "failed_phase": "validation"  
  },  
  "fees": {  
    "network_fee": "0.00",  
    "protocol_fee": "0.00",  
    "total_deducted": "0.00"  
  }  
}

No funds move on a rejected or failed intent. The failure receipt is the definitive record that the attempt was made and why it failed.

---

### Receipt Verification

Any party can verify a receipt independently:

import { verifyPaymentReceipt } from '@gao/sdk';  
  
const result = await verifyPaymentReceipt({  
  receiptId: 'rcpt_pay_abc123',  
  // or provide raw receipt object  
  receipt: receiptObject,  
});  

console.log(result.valid); // boolean
console.log(result.onChainMatch); // confirms tx_hash on-chain
console.log(result.anchorValid); // confirms anchor_tx_hash on-chain
console.log(result.signatureValid); // confirms runtime signature


Verification checks:

1.  Runtime signature over full receipt payload
    
2.  `tx_hash` exists on declared `network` with declared `block_number`
    
3.  `anchor_tx_hash` exists on anchor chain with receipt hash
    
4.  `receipt_id` is unique (not a replay of an existing receipt)
    

---

### Cross-Layer Receipt References

When a Gao Payment receipt is produced as part of an AI agent execution (Layer 8), the GAR receipt references the payment receipt:

{  
  "settlement_refs": [  
    {  
      "payment_receipt_id": "rcpt_pay_abc123",  
      "amount": "25.00",  
      "currency": "USDC",  
      "status": "settled"  
    }  
  ]  
}

This links agent execution records to settlement records, providing a complete audit trail from agent action to on-chain confirmation.

---

### SDK Queries

// Get a specific receipt

const receipt = await gao.payments.receipts.get('rcpt_pay_abc123');  

// List receipts for a domain

const receipts = await gao.payments.receipts.list({  
  payerDomain: 'alice.gao',  
  since: '2026-01-01T00:00:00Z',  
  status: 'settled',  
  limit: 50,  
});  

// Verify a receipt

const verification = await gao.payments.receipts.verify('rcpt_pay_abc123');

Receipts are execution records, not financial instruments. The on-chain transaction is the canonical financial record; the receipt is the protocol-layer audit record that links that transaction to a specific intent, capability grant, and policy snapshot.