{
  "openapi":"3.1.0",
  "info":{"title":"InfiniStack sandbox","version":"1.0.0","description":"Persisted test payments only. No funds or provider calls."},
  "servers":[{"url":"/"}],
  "security":[{"testKey":[]}],
  "paths":{
    "/api/sandbox/payments":{
      "get":{
        "summary":"List the latest 50 payments, or get one test payment",
        "parameters":[{"in":"query","name":"id","schema":{"type":"string"}}],
        "responses":{"200":{"description":"Test payment or payments array"},"401":{"description":"Invalid or revoked key"},"404":{"description":"Payment not found"},"503":{"description":"Database unavailable"}}
      },
      "post":{
        "summary":"Create a simulated payment",
        "parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","pattern":"^[a-zA-Z0-9_-]{8,100}$"}}],
        "requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,
          "required":["amount","currency","country","payment_method","reference"],
          "properties":{
            "amount":{"type":"integer","minimum":100,"maximum":10000000},
            "currency":{"const":"XAF"},
            "country":{"enum":["TD","CM","GA","CG","CF","GQ"]},
            "payment_method":{"enum":["infinite","airtel","moov","mtn","orange"],"description":"Accepted methods vary by test country. Infinite is available for all test countries."},
            "reference":{"type":"string","minLength":1,"maxLength":100},
            "outcome":{"enum":["succeeded","failed","expired","unknown"],"default":"succeeded"},
            "hosted_checkout":{"type":"boolean","default":false,"description":"Return a shareable checkout_url valid for 24 hours. The test payment waits for a confirmation on that page."}
          }
        }}}},
        "responses":{
          "201":{"description":"Payment created. Initial status then progresses to the requested simulated outcome."},
          "200":{"description":"Same request replayed with the same idempotency key"},
          "400":{"description":"Invalid request"},"401":{"description":"Invalid or revoked key"},
          "409":{"description":"Idempotency key was already used with different data"},
          "413":{"description":"Body exceeds 4096 bytes"},"415":{"description":"JSON required"},
          "429":{"description":"100 simulated payments per merchant per rolling day"},
          "503":{"description":"Database unavailable"}
        }
      }
    }
  },
  "components":{"securitySchemes":{"testKey":{"type":"http","scheme":"bearer","description":"Sandbox key issued by the InfiniStack owner after email verification."}}}
}
