> ## Documentation Index
> Fetch the complete documentation index at: https://docs.asgcompute.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Receipts

> Proof of completed work

# Receipts

Every completed tool execution generates a receipt — your proof of work and payment.

## What's in a Receipt?

```json theme={null}
{
  "receipt_id": "rcpt_2026020812345",
  "step_id": "step_abc123",
  "run_id": "run_xyz789",
  "tool": "inference_chat",
  "quoted_usdc_microusd": 2400,
  "debited_usdc_microusd": 2400,
  "created_at": "2026-02-08T12:00:00Z"
}
```

## Receipt Fields

| Field                   | Description                        |
| :---------------------- | :--------------------------------- |
| `receipt_id`            | Unique receipt identifier          |
| `step_id`               | Execution step this receipt covers |
| `run_id`                | Parent run identifier              |
| `tool`                  | Tool that was executed             |
| `quoted_usdc_microusd`  | Original quote amount              |
| `debited_usdc_microusd` | Amount charged                     |
| `created_at`            | When the receipt was issued        |

## Getting Receipts

### In Tool Response

Every tool call includes receipt metadata:

```json theme={null}
{
  "result": {
    "content": "...",
    "_meta": {
      "receipt_id": "rcpt_abc123",
      "debited_usdc_microusd": 85000
    }
  }
}
```

### Query Receipt

Retrieve full receipt details:

```bash theme={null}
curl -X POST https://agent.asgcompute.com/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "billing_get_receipt",
      "arguments": {
        "receipt_id": "rcpt_abc123"
      }
    }
  }'
```

## Receipt Retention

Receipts are stored for **30 days**. Export receipts for accounting purposes before expiration.

***

## Verify a Receipt

Every receipt is independently verifiable — both through the ASG API and directly on the Solana blockchain.

### Step 1: Look Up the Receipt

Use the `billing_get_receipt` tool to retrieve full receipt details by ID:

```bash theme={null}
curl -X POST https://agent.asgcompute.com/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "billing_get_receipt",
      "arguments": {
        "receipt_id": "rcpt_2026020812345"
      }
    }
  }'
```

**Response:**

```json theme={null}
{
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\"receipt_id\":\"rcpt_2026020812345\",\"tool\":\"inference_chat\",\"quoted_usdc_microusd\":2400,\"debited_usdc_microusd\":2400,\"tx_signature\":\"5UxK...7nPq\",\"created_at\":\"2026-02-08T12:00:00Z\"}"
      }
    ]
  }
}
```

### Step 2: Verify On-Chain

Every receipt includes a `tx_signature` field — the Solana transaction signature. Use it to verify the payment on-chain:

**Solana Explorer URL format:**

```
https://explorer.solana.com/tx/<TX_SIGNATURE>
```

For example, if `tx_signature` is `5UxK...7nPq`:

```
https://explorer.solana.com/tx/5UxK...7nPq
```

<Tip>
  Bookmark the Solana Explorer link for quick access: [explorer.solana.com](https://explorer.solana.com)
</Tip>

### Step 3: Cross-Reference

Verify that the on-chain transaction matches your receipt:

| Receipt Field           | On-Chain Check                      |
| :---------------------- | :---------------------------------- |
| `debited_usdc_microusd` | Amount transferred matches          |
| `tx_signature`          | Transaction exists and is finalized |
| `created_at`            | Timestamp aligns with block time    |

<Note>
  All Solana transactions are on **mainnet**. Ensure you're viewing the mainnet explorer, not devnet.
</Note>

### Programmatic Verification

For automated verification, you can query the Solana RPC directly:

```bash theme={null}
curl -X POST https://api.mainnet-beta.solana.com \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getTransaction",
    "params": [
      "YOUR_TX_SIGNATURE",
      { "encoding": "json", "maxSupportedTransactionVersion": 0 }
    ]
  }'
```

This returns the full transaction details including sender, recipient, amount, and confirmation status.
