Gift Card Balance Replay

Replay gift-card loads and redemptions, separating exact duplicate events, conflicting event IDs and rejected insufficient-balance activity.

Custom requests cost 0.04 USDC on Base.

Download example JSON · OpenAPI · Source and usage

Pay with a browser wallet · Open example in checkout

POST a JSON request to /gift-card-balance-replay/v1/check with an x402 V2 client.

Worked example

Request

{
  "opening": [
    {
      "card": "x",
      "balance_cents": 100
    }
  ],
  "events": [
    {
      "id": "a",
      "card": "x",
      "type": "redeem",
      "cents": 75
    },
    {
      "id": "a",
      "card": "x",
      "type": "redeem",
      "cents": 75
    },
    {
      "id": "a",
      "card": "x",
      "type": "load",
      "cents": 75
    },
    {
      "id": "b",
      "card": "x",
      "type": "redeem",
      "cents": 50
    },
    {
      "id": "c",
      "card": "y",
      "type": "load",
      "cents": 200
    }
  ]
}

Result

{
  "outstanding_cents": 225,
  "balances": [
    {
      "card": "x",
      "balance_cents": 25
    },
    {
      "card": "y",
      "balance_cents": 200
    }
  ],
  "duplicates": [
    1
  ],
  "rejected": [
    {
      "index": 2,
      "reason": "conflicting_event_id"
    },
    {
      "index": 3,
      "reason": "insufficient_balance"
    }
  ]
}

Support catalog maintenance through GitHub Sponsors. Sponsor gptenv · Sponsor Jeremy Carter