{
  "openapi": "3.1.0",
  "info": {
    "title": "Rehocode Partner Sandbox API",
    "version": "0.1.0-draft",
    "description": "Draft contract based on locally validated sandbox tests. Not a deployed API. No live payment execution."
  },
  "x-rehocode-deployment-status": "not-deployed",
  "tags": [
    {
      "name": "Payment Intents"
    }
  ],
  "components": {
    "securitySchemes": {
      "PartnerBearer": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "PaymentIntentCreate": {
        "type": "object",
        "required": [
          "amount_minor",
          "currency",
          "merchant_reference"
        ],
        "properties": {
          "amount_minor": {
            "type": "integer",
            "minimum": 1,
            "description": "Amount in currency minor units"
          },
          "currency": {
            "type": "string",
            "enum": [
              "NGN"
            ]
          },
          "merchant_reference": {
            "type": "string",
            "minLength": 1
          },
          "description": {
            "type": "string"
          }
        }
      },
      "PaymentStatus": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "Status returned by the backend"
          },
          "source": {
            "type": "string",
            "enum": [
              "backend_database"
            ]
          },
          "sandbox": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "financial_execution": {
            "type": "boolean",
            "enum": [
              false
            ]
          }
        }
      }
    }
  },
  "security": [
    {
      "PartnerBearer": []
    }
  ],
  "paths": {
    "/partner/v1/payment-intents": {
      "post": {
        "tags": [
          "Payment Intents"
        ],
        "summary": "Create sandbox payment intent",
        "x-required-scope": "payments:create",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentIntentCreate"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Sandbox intent created; not confirmation of settlement"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Insufficient permissions"
          },
          "409": {
            "description": "Idempotency conflict"
          },
          "422": {
            "description": "Invalid request"
          }
        }
      }
    },
    "/partner/v1/payment-intents/{id}": {
      "get": {
        "tags": [
          "Payment Intents"
        ],
        "summary": "Retrieve backend payment status",
        "x-required-scope": "payments:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authoritative sandbox status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentStatus"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Insufficient permissions"
          },
          "404": {
            "description": "Payment not found"
          }
        }
      }
    }
  }
}
