{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ticktape-cc/json-schema/ticktape-cc-credits-purchase-response-schema.json",
  "title": "CreditsPurchaseResponse",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ticktape-cc-openapi.json#/components/schemas/CreditsPurchaseResponse",
  "type": "object",
  "required": [
    "ok",
    "token",
    "wallet",
    "credits_added",
    "balance"
  ],
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "token": {
      "type": "string",
      "description": "Bearer token, format tk_<wallet>_<secret>. Treat as a secret; shown in full only in this response. The last 5 tokens per wallet stay valid."
    },
    "wallet": {
      "type": "string",
      "description": "Paying wallet the credits are keyed to."
    },
    "credits_added": {
      "type": "integer",
      "description": "500 per $5 pack."
    },
    "balance": {
      "type": "integer",
      "description": "Total credits now on the wallet."
    },
    "expires": {
      "type": "string",
      "format": "date-time",
      "description": "Credits are valid 12 months from purchase."
    },
    "note": {
      "type": "string"
    },
    "paid": {
      "$ref": "#/$defs/Paid"
    }
  },
  "$defs": {
    "Paid": {
      "type": "object",
      "description": "Payment record attached to paid responses. Per-call x402 settlement: {price_paid_usdc, transaction, network, receipt}. Credit-lane (bearer token) calls: {credits_used, credits_remaining}. Absent on sandbox and free QUEUED responses.",
      "properties": {
        "price_paid_usdc": {
          "type": "string",
          "description": "USDC actually settled for this call, as a decimal string (e.g. \"0.02\")."
        },
        "transaction": {
          "type": "string",
          "description": "On-chain settlement transaction hash."
        },
        "network": {
          "type": "string",
          "description": "CAIP-2 network id, eip155:8453 (Base)."
        },
        "receipt": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Basescan transaction link for the on-chain settlement."
        },
        "credits_used": {
          "type": "integer",
          "description": "Credits debited for this call (credit-lane only)."
        },
        "credits_remaining": {
          "type": "integer",
          "description": "Credits left on the wallet after this call (credit-lane only)."
        }
      }
    }
  }
}