{
 "openapi":"3.1.0","info":{"title":"SANPAY","version":"1.0.0","description":"IC sandbox payment orchestration. No spendable balances. Live collection and refunds are unavailable."},"servers":[{"url":"https://pay.santos-v.com"}],"security":[{"bearerAuth":[]}],
 "paths":{
  "/api/health":{"get":{"security":[],"summary":"Database and schema readiness","responses":{"200":{"description":"Ready"},"503":{"description":"Unavailable"}}}},
  "/api/v1/checkout/sessions":{"post":{"summary":"Create sandbox checkout","parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","minLength":8,"maxLength":120,"pattern":"^[A-Za-z0-9_.:-]+$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCheckout"}}}},"responses":{"200":{"description":"Created or idempotent replay","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Payment"},{"type":"object","properties":{"checkout_url":{"type":"string","format":"uri"}}}]}}}},"default":{"$ref":"#/components/responses/Error"}}}},
  "/api/v1/checkout/sessions/{id}":{"get":{"summary":"Read own checkout","parameters":[{"$ref":"#/components/parameters/Id"}],"responses":{"200":{"$ref":"#/components/responses/Payment"},"default":{"$ref":"#/components/responses/Error"}}}},
  "/api/v1/payments/{id}":{"get":{"summary":"Read own payment","parameters":[{"$ref":"#/components/parameters/Id"}],"responses":{"200":{"$ref":"#/components/responses/Payment"},"default":{"$ref":"#/components/responses/Error"}}}},
  "/api/v1/payments":{"get":{"summary":"Paginated own test payments","parameters":[{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":50,"default":20}},{"in":"query","name":"offset","schema":{"type":"integer","minimum":0,"maximum":10000,"default":0}}],"responses":{"200":{"description":"Page","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Payment"}},"has_more":{"type":"boolean"},"next_offset":{"type":"integer"}}}}}},"default":{"$ref":"#/components/responses/Error"}}}},
  "/api/v1/refunds":{"post":{"summary":"Unavailable: refunds fail closed","responses":{"503":{"$ref":"#/components/responses/Error"},"default":{"$ref":"#/components/responses/Error"}}}},
  "/api/v1/refunds/{id}":{"get":{"summary":"Unavailable: refund lookup","parameters":[{"$ref":"#/components/parameters/Id"}],"responses":{"503":{"$ref":"#/components/responses/Error"},"default":{"$ref":"#/components/responses/Error"}}}}
 },
 "components":{
  "securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Server-only svp_test secret. Scopes: checkout:write, payments:read."}},
  "parameters":{"Id":{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}},
  "responses":{"Error":{"description":"Standard error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Payment":{"description":"Payment","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}}},
  "schemas":{
   "Error":{"type":"object","required":["code","message","request_id"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string","format":"uuid"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}},
   "CreateCheckout":{"type":"object","additionalProperties":false,"required":["amount","currency","order_id","description","success_url","cancel_url"],"properties":{"amount":{"type":"integer","minimum":1,"maximum":100000},"currency":{"const":"$"},"order_id":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","minLength":1,"maxLength":240},"success_url":{"type":"string","format":"uri","maxLength":500},"cancel_url":{"type":"string","format":"uri","maxLength":500},"metadata":{"type":"object","maxProperties":12,"propertyNames":{"maxLength":40},"additionalProperties":{"type":"string","maxLength":200}}}},
   "Pricing":{"type":"object","description":"Immutable checkout pricing. Rates apply independently to the base amount. Basis points: 100 = 1%. Half-cent rounds up, with one-cent tax adjustment if combined rounding exceeds base at 100%.","required":["version","commission_bps","tax_bps","commission_payer","tax_payer","base_minor","commission_minor","tax_minor","total_minor","merchant_net_minor"],"properties":{"version":{"const":1},"commission_bps":{"type":"integer","minimum":0,"maximum":10000},"tax_bps":{"type":"integer","minimum":0,"maximum":10000},"commission_payer":{"enum":["merchant","customer"]},"tax_payer":{"enum":["merchant","customer"]},"base_minor":{"type":"integer","minimum":0,"description":"Integer cents (100 = $1); calculation only in sandbox."},"commission_minor":{"type":"integer","minimum":0,"description":"Integer cents (100 = $1); calculation only in sandbox."},"tax_minor":{"type":"integer","minimum":0,"description":"Integer cents (100 = $1); calculation only in sandbox."},"total_minor":{"type":"integer","minimum":0,"description":"Integer cents (100 = $1); calculation only in sandbox."},"merchant_net_minor":{"type":"integer","minimum":0,"description":"Integer cents (100 = $1); calculation only in sandbox."}}},
   "Payment":{"type":"object","required":["id","merchant_id","mode","status","amount","currency","order_id","description","metadata","created_at","expires_at"],"properties":{"id":{"type":"string","format":"uuid"},"merchant_id":{"type":"string","format":"uuid"},"mode":{"enum":["test","live"]},"status":{"enum":["created","succeeded","failed","cancelled"]},"amount":{"type":"integer","description":"Original order amount in whole dollars; excludes fees added to the customer total."},"currency":{"const":"$"},"order_id":{"type":"string"},"description":{"type":"string"},"metadata":{"type":"object","additionalProperties":{"type":"string"}},"operation_reference":{"type":["string","null"]},"error_code":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"expires_at":{"type":"string","format":"date-time"},"total_amount":{"type":"number","description":"Customer total in dollars including customer-paid commission and tax."},"pricing":{"$ref":"#/components/schemas/Pricing"}}},
   "WebhookEvent":{"type":"object","required":["id","type","created_at","data"],"properties":{"id":{"type":"string","format":"uuid"},"type":{"enum":["payment.created","payment.succeeded","payment.failed","payment.cancelled"]},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Payment"}}}
  }
 }
}
