{"openapi":"3.1.0","info":{"title":"Gift Card Balance Replay","version":"1.0.0","description":"Replay gift-card loads and redemptions, separating exact duplicate events, conflicting event IDs and rejected insufficient-balance activity.","contact":{"email":"jeremy@jeremycarter.ca"}},"servers":[{"url":"https://gptenv-x402-catalog.defcronyke.workers.dev"}],"paths":{"/gift-card-balance-replay/v1/check":{"post":{"operationId":"gift_card_balance_replay","summary":"Replay gift-card loads and redemptions, separating exact duplicate events, conflicting event IDs and rejected insufficient-balance activity.","x-payment-info":{"protocols":[{"x402":{}}],"price":{"mode":"fixed","currency":"USD","amount":"0.04"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"opening":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"card":{"type":"string","minLength":1,"maxLength":80},"balance_cents":{"type":"integer","minimum":0,"maximum":1000000000}},"required":["card","balance_cents"],"additionalProperties":false}},"events":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":80},"card":{"type":"string","minLength":1,"maxLength":80},"type":{"type":"string","enum":["load","redeem"]},"cents":{"type":"integer","minimum":1,"maximum":1000000000}},"required":["id","card","type","cents"],"additionalProperties":false}}},"required":["opening","events"],"additionalProperties":false},"example":{"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}]}}}},"responses":{"200":{"description":"Service result","content":{"application/json":{"schema":{"type":"object"},"example":{"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"}]}}}},"400":{"description":"Invalid request"},"402":{"description":"x402 exact payment required on Base"},"503":{"description":"Payment unavailable"}}}}}}