{
 "openapi": "3.1.0",
 "info": {
  "title": "Payflow API",
  "version": "2026-09-01",
  "description": "A API pública do Payflow (Kingdom). Dinheiro em inteiros na subunidade da moeda; datas ISO 8601 em UTC com Z; IDs com prefixo (prod_, ord_, cus_, evt_, re_, cs_, we_). Chaves sk_live_/sk_test_ no cabeçalho Authorization. Erros RFC 9457. Paginação por cursor. Veja o README do repositório para as assinaturas dos webhooks."
 },
 "servers": [
  {
   "url": "https://api.kingdomcompny.com/v1"
  },
  {
   "url": "https://epqfotzxrcyligwpauwk.supabase.co/functions/v1/api/v1"
  }
 ],
 "security": [
  {
   "chave": []
  }
 ],
 "paths": {
  "/products": {
   "get": {
    "operationId": "list_products",
    "summary": "Listar products",
    "tags": [
     "products"
    ],
    "x-scope": "products:read",
    "parameters": [
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "$ref": "#/components/parameters/StartingAfter"
     },
     {
      "$ref": "#/components/parameters/KingdomVersion"
     },
     {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
       "enum": [
        "active",
        "inactive"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ProductList"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/products/{id}": {
   "get": {
    "operationId": "get_products",
    "summary": "Obter um de products",
    "tags": [
     "products"
    ],
    "x-scope": "products:read",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^prod_[0-9A-HJKMNP-TV-Z]{26}$"
      }
     },
     {
      "$ref": "#/components/parameters/KingdomVersion"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Product"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/orders": {
   "get": {
    "operationId": "list_orders",
    "summary": "Listar orders",
    "tags": [
     "orders"
    ],
    "x-scope": "orders:read",
    "parameters": [
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "$ref": "#/components/parameters/StartingAfter"
     },
     {
      "$ref": "#/components/parameters/KingdomVersion"
     },
     {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
       "$ref": "#/components/schemas/OrderStatus"
      }
     },
     {
      "name": "created[gte]",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "ISO 8601 ou segundos Unix"
     },
     {
      "name": "created[lte]",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "customer_email",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "metadata",
      "in": "query",
      "style": "deepObject",
      "explode": true,
      "schema": {
       "type": "object",
       "additionalProperties": {
        "type": "string"
       }
      },
      "description": "metadata[chave]=valor"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/OrderList"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/orders/{id}": {
   "get": {
    "operationId": "get_orders",
    "summary": "Obter um de orders",
    "tags": [
     "orders"
    ],
    "x-scope": "orders:read",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^ord_[0-9A-HJKMNP-TV-Z]{26}$"
      }
     },
     {
      "$ref": "#/components/parameters/KingdomVersion"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Order"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/customers": {
   "get": {
    "operationId": "list_customers",
    "summary": "Listar customers",
    "tags": [
     "customers"
    ],
    "x-scope": "customers:read",
    "parameters": [
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "$ref": "#/components/parameters/StartingAfter"
     },
     {
      "$ref": "#/components/parameters/KingdomVersion"
     },
     {
      "name": "email",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CustomerList"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/customers/{id}": {
   "get": {
    "operationId": "get_customers",
    "summary": "Obter um de customers",
    "tags": [
     "customers"
    ],
    "x-scope": "customers:read",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^cus_[0-9A-HJKMNP-TV-Z]{26}$"
      }
     },
     {
      "$ref": "#/components/parameters/KingdomVersion"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Customer"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/events": {
   "get": {
    "operationId": "list_events",
    "summary": "Listar events",
    "tags": [
     "events"
    ],
    "x-scope": "events:read",
    "parameters": [
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "$ref": "#/components/parameters/StartingAfter"
     },
     {
      "$ref": "#/components/parameters/KingdomVersion"
     },
     {
      "name": "type",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "order",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/EventList"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/events/{id}": {
   "get": {
    "operationId": "get_events",
    "summary": "Obter um de events",
    "tags": [
     "events"
    ],
    "x-scope": "events:read",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$"
      }
     },
     {
      "$ref": "#/components/parameters/KingdomVersion"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Event"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/refunds": {
   "get": {
    "operationId": "list_refunds",
    "summary": "Listar refunds",
    "tags": [
     "refunds"
    ],
    "x-scope": "refunds:read",
    "parameters": [
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "$ref": "#/components/parameters/StartingAfter"
     },
     {
      "$ref": "#/components/parameters/KingdomVersion"
     },
     {
      "name": "order",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/RefundList"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "create_refund",
    "summary": "Reembolsar um pedido, todo ou em parte",
    "tags": [
     "refunds"
    ],
    "x-scope": "refunds:write",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/KingdomVersion"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "order",
         "reason"
        ],
        "properties": {
         "order": {
          "type": "string",
          "pattern": "^ord_[0-9A-HJKMNP-TV-Z]{26}$"
         },
         "amount": {
          "type": "integer",
          "minimum": 1,
          "description": "Subunidades. Sem valor: tudo o que falta devolver."
         },
         "reason": {
          "type": "string",
          "minLength": 1
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Criado e aprovado. Pela Paystack executa-se já; pelo M-Pesa espera a execução no painel.",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Refund"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/refunds/{id}": {
   "get": {
    "operationId": "get_refunds",
    "summary": "Obter um de refunds",
    "tags": [
     "refunds"
    ],
    "x-scope": "refunds:read",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^re_[0-9A-HJKMNP-TV-Z]{26}$"
      }
     },
     {
      "$ref": "#/components/parameters/KingdomVersion"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Refund"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/checkout_sessions": {
   "get": {
    "operationId": "list_checkout_sessions",
    "summary": "Listar checkout_sessions",
    "tags": [
     "checkout_sessions"
    ],
    "x-scope": "checkout_sessions:read",
    "parameters": [
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "$ref": "#/components/parameters/StartingAfter"
     },
     {
      "$ref": "#/components/parameters/KingdomVersion"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CheckoutSessionList"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "create_checkout_session",
    "summary": "Criar uma sessão de checkout",
    "tags": [
     "checkout_sessions"
    ],
    "x-scope": "checkout_sessions:write",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/KingdomVersion"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "items"
        ],
        "properties": {
         "items": {
          "type": "array",
          "minItems": 1,
          "maxItems": 1,
          "items": {
           "type": "object",
           "required": [
            "product"
           ],
           "properties": {
            "product": {
             "type": "string",
             "pattern": "^prod_[0-9A-HJKMNP-TV-Z]{26}$"
            },
            "quantity": {
             "const": 1
            }
           }
          }
         },
         "customer": {
          "type": "object",
          "properties": {
           "email": {
            "type": "string",
            "format": "email"
           },
           "name": {
            "type": "string"
           },
           "phone": {
            "type": "string"
           }
          }
         },
         "locale": {
          "enum": [
           "en",
           "pt",
           "es"
          ]
         },
         "metadata": {
          "type": "object",
          "additionalProperties": {
           "type": [
            "string",
            "null"
           ]
          },
          "maxProperties": 51,
          "description": "Mapa de texto para texto, até 50 chaves. member_user_id vai sempre (null sem ref)."
         },
         "return_url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
         },
         "expires_in": {
          "type": "integer",
          "minimum": 1800,
          "maximum": 604800,
          "default": 86400
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Criada. Manda quem vai pagar para o `url`.",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CheckoutSession"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/checkout_sessions/{id}": {
   "get": {
    "operationId": "get_checkout_sessions",
    "summary": "Obter um de checkout_sessions",
    "tags": [
     "checkout_sessions"
    ],
    "x-scope": "checkout_sessions:read",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^cs_[0-9A-HJKMNP-TV-Z]{26}$"
      }
     },
     {
      "$ref": "#/components/parameters/KingdomVersion"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CheckoutSession"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/checkout_sessions/{id}/expire": {
   "post": {
    "operationId": "expire_checkout_session",
    "summary": "Expirar uma sessão aberta",
    "tags": [
     "checkout_sessions"
    ],
    "x-scope": "checkout_sessions:write",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^cs_[0-9A-HJKMNP-TV-Z]{26}$"
      }
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CheckoutSession"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/webhook_endpoints": {
   "get": {
    "operationId": "list_webhook_endpoints",
    "summary": "Listar webhook_endpoints",
    "tags": [
     "webhook_endpoints"
    ],
    "x-scope": "webhooks:read",
    "parameters": [
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "$ref": "#/components/parameters/StartingAfter"
     },
     {
      "$ref": "#/components/parameters/KingdomVersion"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WebhookEndpointList"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "create_webhook_endpoint",
    "summary": "Criar um endpoint de webhooks",
    "tags": [
     "webhook_endpoints"
    ],
    "x-scope": "webhooks:write",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "url"
        ],
        "properties": {
         "url": {
          "type": "string",
          "pattern": "^https://"
         },
         "description": {
          "type": "string"
         },
         "enabled_events": {
          "type": "array",
          "items": {
           "enum": [
            "order.paid",
            "order.refunded",
            "order.disputed",
            "order.dispute_resolved"
           ]
          }
         },
         "products": {
          "type": "array",
          "items": {
           "type": "string",
           "pattern": "^prod_[0-9A-HJKMNP-TV-Z]{26}$"
          }
         },
         "return_url_domains": {
          "type": "array",
          "items": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Criado. O `secret` só se mostra agora.",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WebhookEndpoint"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/webhook_endpoints/{id}": {
   "get": {
    "operationId": "get_webhook_endpoints",
    "summary": "Obter um de webhook_endpoints",
    "tags": [
     "webhook_endpoints"
    ],
    "x-scope": "webhooks:read",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^we_[0-9A-HJKMNP-TV-Z]{26}$"
      }
     },
     {
      "$ref": "#/components/parameters/KingdomVersion"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WebhookEndpoint"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "update_webhook_endpoint",
    "summary": "Actualizar",
    "tags": [
     "webhook_endpoints"
    ],
    "x-scope": "webhooks:write",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^we_[0-9A-HJKMNP-TV-Z]{26}$"
      }
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "url": {
          "type": "string"
         },
         "description": {
          "type": "string"
         },
         "enabled_events": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "products": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "return_url_domains": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "status": {
          "enum": [
           "enabled",
           "paused"
          ]
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WebhookEndpoint"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "delete": {
    "operationId": "delete_webhook_endpoint",
    "summary": "Apagar",
    "tags": [
     "webhook_endpoints"
    ],
    "x-scope": "webhooks:write",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^we_[0-9A-HJKMNP-TV-Z]{26}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/DeletedWebhookEndpoint"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/webhook_endpoints/{id}/rotate_secret": {
   "post": {
    "operationId": "rotate_webhook_secret",
    "summary": "Rodar o segredo (o antigo vale mais 24 h)",
    "tags": [
     "webhook_endpoints"
    ],
    "x-scope": "webhooks:write",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^we_[0-9A-HJKMNP-TV-Z]{26}$"
      }
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WebhookEndpoint"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/webhook_endpoints/{id}/test": {
   "post": {
    "operationId": "test_webhook_endpoint",
    "summary": "Enviar um integration.test agora",
    "tags": [
     "webhook_endpoints"
    ],
    "x-scope": "webhooks:write",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^we_[0-9A-HJKMNP-TV-Z]{26}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "Request-Id": {
        "$ref": "#/components/headers/Request-Id"
       },
       "RateLimit-Remaining": {
        "$ref": "#/components/headers/RateLimit-Remaining"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WebhookTest"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "409": {
      "$ref": "#/components/responses/Problem"
     },
     "422": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     },
     "500": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  }
 },
 "webhooks": {
  "order.paid": {
   "post": {
    "summary": "order.paid",
    "description": "Pagamento confirmado pela Paystack (verify) ou pelo M-Pesa, ou confirmado à mão.",
    "parameters": [
     {
      "name": "X-Kingdom-Event-Id",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "X-Kingdom-Event-Type",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "X-Kingdom-Signature",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "webhook-id",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "webhook-timestamp",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "webhook-signature",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/Event.order.paid"
       }
      }
     }
    },
    "responses": {
     "2XX": {
      "description": "Recebido. Qualquer 2xx conta como entregue, incluindo {\"duplicate\":true}."
     }
    }
   }
  },
  "order.refunded": {
   "post": {
    "summary": "order.refunded",
    "description": "Cada reembolso executado, parcial ou total. refunded_amount é o acumulado.",
    "parameters": [
     {
      "name": "X-Kingdom-Event-Id",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "X-Kingdom-Event-Type",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "X-Kingdom-Signature",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "webhook-id",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "webhook-timestamp",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "webhook-signature",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/Event.order.refunded"
       }
      }
     }
    },
    "responses": {
     "2XX": {
      "description": "Recebido. Qualquer 2xx conta como entregue, incluindo {\"duplicate\":true}."
     }
    }
   }
  },
  "order.disputed": {
   "post": {
    "summary": "order.disputed",
    "description": "Disputa aberta (chargeback).",
    "parameters": [
     {
      "name": "X-Kingdom-Event-Id",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "X-Kingdom-Event-Type",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "X-Kingdom-Signature",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "webhook-id",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "webhook-timestamp",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "webhook-signature",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/Event.order.disputed"
       }
      }
     }
    },
    "responses": {
     "2XX": {
      "description": "Recebido. Qualquer 2xx conta como entregue, incluindo {\"duplicate\":true}."
     }
    }
   }
  },
  "order.dispute_resolved": {
   "post": {
    "summary": "order.dispute_resolved",
    "description": "Disputa fechada. outcome: won ou lost.",
    "parameters": [
     {
      "name": "X-Kingdom-Event-Id",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "X-Kingdom-Event-Type",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "X-Kingdom-Signature",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "webhook-id",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "webhook-timestamp",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "webhook-signature",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/Event.order.dispute_resolved"
       }
      }
     }
    },
    "responses": {
     "2XX": {
      "description": "Recebido. Qualquer 2xx conta como entregue, incluindo {\"duplicate\":true}."
     }
    }
   }
  },
  "integration.test": {
   "post": {
    "summary": "integration.test",
    "description": "Botão «Enviar evento de teste», ou POST /webhook_endpoints/{id}/test.",
    "parameters": [
     {
      "name": "X-Kingdom-Event-Id",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "X-Kingdom-Event-Type",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "X-Kingdom-Signature",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "webhook-id",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "webhook-timestamp",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "webhook-signature",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/Event.integration.test"
       }
      }
     }
    },
    "responses": {
     "2XX": {
      "description": "Recebido. Qualquer 2xx conta como entregue, incluindo {\"duplicate\":true}."
     }
    }
   }
  }
 },
 "components": {
  "securitySchemes": {
   "chave": {
    "type": "http",
    "scheme": "bearer",
    "bearerFormat": "sk_live_… / sk_test_…"
   }
  },
  "parameters": {
   "Limit": {
    "name": "limit",
    "in": "query",
    "schema": {
     "type": "integer",
     "minimum": 1,
     "maximum": 100,
     "default": 10
    }
   },
   "StartingAfter": {
    "name": "starting_after",
    "in": "query",
    "schema": {
     "type": "string"
    },
    "description": "O next_cursor da página anterior."
   },
   "IdempotencyKey": {
    "name": "Idempotency-Key",
    "in": "header",
    "schema": {
     "type": "string",
     "maxLength": 255
    },
    "description": "A resposta guarda-se 24 h e devolve-se igual se a chave se repetir; a mesma chave com outro corpo dá 409."
   },
   "KingdomVersion": {
    "name": "Kingdom-Version",
    "in": "header",
    "schema": {
     "enum": [
      "2026-09-01"
     ]
    },
    "description": "Sem o cabeçalho, vale a versão da chave."
   }
  },
  "headers": {
   "Request-Id": {
    "schema": {
     "type": "string"
    }
   },
   "RateLimit-Remaining": {
    "schema": {
     "type": "integer"
    }
   }
  },
  "responses": {
   "Problem": {
    "description": "Erro",
    "content": {
     "application/problem+json": {
      "schema": {
       "$ref": "#/components/schemas/Problem"
      }
     }
    }
   }
  },
  "schemas": {
   "Problem": {
    "type": "object",
    "required": [
     "type",
     "title",
     "status",
     "detail",
     "code",
     "request_id"
    ],
    "description": "RFC 9457 (application/problem+json). `code` é estável; `detail` é para pessoas.",
    "properties": {
     "type": {
      "type": "string",
      "format": "uri"
     },
     "title": {
      "type": "string"
     },
     "status": {
      "type": "integer"
     },
     "detail": {
      "type": "string"
     },
     "code": {
      "type": "string"
     },
     "param": {
      "type": "string"
     },
     "request_id": {
      "type": "string",
      "pattern": "^req_"
     }
    }
   },
   "Product": {
    "type": "object",
    "required": [
     "id",
     "object",
     "name",
     "price",
     "status",
     "checkout_url",
     "created_at",
     "livemode"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^prod_[0-9A-HJKMNP-TV-Z]{26}$"
     },
     "object": {
      "const": "product"
     },
     "name": {
      "type": "string"
     },
     "description": {
      "type": [
       "string",
       "null"
      ]
     },
     "price": {
      "type": "object",
      "required": [
       "amount",
       "currency"
      ],
      "properties": {
       "amount": {
        "type": "integer",
        "minimum": 0,
        "description": "Em subunidades da moeda (R 149,00 = 14900)."
       },
       "currency": {
        "type": "string",
        "pattern": "^[A-Z]{3}$",
        "description": "ISO 4217"
       }
      }
     },
     "status": {
      "enum": [
       "active",
       "inactive"
      ]
     },
     "checkout_url": {
      "type": "string",
      "format": "uri"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "Z$"
     },
     "livemode": {
      "type": "boolean"
     }
    }
   },
   "Customer": {
    "type": "object",
    "required": [
     "id",
     "object",
     "email",
     "created_at",
     "livemode"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^cus_[0-9A-HJKMNP-TV-Z]{26}$"
     },
     "object": {
      "const": "customer"
     },
     "email": {
      "type": "string",
      "format": "email"
     },
     "name": {
      "type": [
       "string",
       "null"
      ]
     },
     "phone": {
      "type": [
       "string",
       "null"
      ]
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "Z$"
     },
     "livemode": {
      "type": "boolean"
     }
    }
   },
   "OrderCustomer": {
    "type": "object",
    "required": [
     "id",
     "email",
     "name",
     "phone"
    ],
    "properties": {
     "id": {
      "type": [
       "string",
       "null"
      ]
     },
     "email": {
      "type": [
       "string",
       "null"
      ]
     },
     "name": {
      "type": [
       "string",
       "null"
      ]
     },
     "phone": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   },
   "OrderItem": {
    "type": "object",
    "required": [
     "product_id",
     "name",
     "quantity",
     "unit_amount"
    ],
    "properties": {
     "product_id": {
      "type": "string",
      "pattern": "^prod_[0-9A-HJKMNP-TV-Z]{26}$"
     },
     "sku": {
      "type": [
       "string",
       "null"
      ]
     },
     "name": {
      "type": "string"
     },
     "quantity": {
      "type": "integer",
      "minimum": 1
     },
     "unit_amount": {
      "type": "integer",
      "minimum": 0,
      "description": "Em subunidades da moeda (R 149,00 = 14900)."
     }
    }
   },
   "OrderStatus": {
    "enum": [
     "pending",
     "paid",
     "partially_refunded",
     "refunded",
     "disputed",
     "dispute_won",
     "dispute_lost"
    ]
   },
   "Order": {
    "type": "object",
    "required": [
     "id",
     "object",
     "reference",
     "status",
     "amount",
     "currency",
     "refunded_amount",
     "full_refund",
     "paid_at",
     "created_at",
     "provider",
     "provider_reference",
     "livemode",
     "customer",
     "items",
     "metadata",
     "locale"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^ord_[0-9A-HJKMNP-TV-Z]{26}$"
     },
     "object": {
      "const": "order"
     },
     "reference": {
      "type": "string",
      "pattern": "^KG-[0-9]{8}-[0-9A-HJKMNP-TV-Z]{5}$"
     },
     "status": {
      "$ref": "#/components/schemas/OrderStatus"
     },
     "amount": {
      "type": "integer",
      "minimum": 0,
      "description": "Em subunidades da moeda (R 149,00 = 14900)."
     },
     "currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$",
      "description": "ISO 4217"
     },
     "refunded_amount": {
      "type": "integer",
      "minimum": 0,
      "description": "Em subunidades da moeda (R 149,00 = 14900)."
     },
     "full_refund": {
      "type": "boolean"
     },
     "paid_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "Z$"
     },
     "provider": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "paystack",
       "mpesa",
       "manual",
       null
      ]
     },
     "provider_reference": {
      "type": [
       "string",
       "null"
      ]
     },
     "livemode": {
      "type": "boolean"
     },
     "customer": {
      "$ref": "#/components/schemas/OrderCustomer"
     },
     "items": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/OrderItem"
      }
     },
     "metadata": {
      "type": "object",
      "additionalProperties": {
       "type": [
        "string",
        "null"
       ]
      },
      "maxProperties": 51,
      "description": "Mapa de texto para texto, até 50 chaves. member_user_id vai sempre (null sem ref)."
     },
     "locale": {
      "enum": [
       "en",
       "pt",
       "es"
      ]
     }
    }
   },
   "Refund": {
    "type": "object",
    "required": [
     "id",
     "object",
     "order",
     "amount",
     "currency",
     "status",
     "created_at",
     "livemode"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^re_[0-9A-HJKMNP-TV-Z]{26}$"
     },
     "object": {
      "const": "refund"
     },
     "order": {
      "type": "string",
      "pattern": "^ord_[0-9A-HJKMNP-TV-Z]{26}$"
     },
     "amount": {
      "type": "integer",
      "minimum": 0,
      "description": "Em subunidades da moeda (R 149,00 = 14900)."
     },
     "currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$",
      "description": "ISO 4217"
     },
     "reason": {
      "type": [
       "string",
       "null"
      ]
     },
     "status": {
      "enum": [
       "pending",
       "succeeded",
       "failed",
       "canceled"
      ]
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "Z$"
     },
     "livemode": {
      "type": "boolean"
     }
    }
   },
   "CheckoutSession": {
    "type": "object",
    "required": [
     "id",
     "object",
     "url",
     "status",
     "product",
     "expires_at",
     "created_at",
     "livemode"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^cs_[0-9A-HJKMNP-TV-Z]{26}$"
     },
     "object": {
      "const": "checkout_session"
     },
     "url": {
      "type": [
       "string",
       "null"
      ],
      "format": "uri"
     },
     "status": {
      "enum": [
       "open",
       "complete",
       "expired"
      ]
     },
     "product": {
      "type": "string",
      "pattern": "^prod_[0-9A-HJKMNP-TV-Z]{26}$"
     },
     "customer_email": {
      "type": [
       "string",
       "null"
      ]
     },
     "customer_name": {
      "type": [
       "string",
       "null"
      ]
     },
     "customer_phone": {
      "type": [
       "string",
       "null"
      ]
     },
     "locale": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "en",
       "pt",
       "es",
       null
      ]
     },
     "metadata": {
      "type": "object",
      "additionalProperties": {
       "type": [
        "string",
        "null"
       ]
      },
      "maxProperties": 51,
      "description": "Mapa de texto para texto, até 50 chaves. member_user_id vai sempre (null sem ref)."
     },
     "return_url": {
      "type": [
       "string",
       "null"
      ]
     },
     "order": {
      "type": [
       "string",
       "null"
      ]
     },
     "expires_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "Z$"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "Z$"
     },
     "livemode": {
      "type": "boolean"
     }
    }
   },
   "WebhookEndpoint": {
    "type": "object",
    "required": [
     "id",
     "object",
     "url",
     "enabled_events",
     "status",
     "api_version",
     "livemode",
     "created_at"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^we_[0-9A-HJKMNP-TV-Z]{26}$"
     },
     "object": {
      "const": "webhook_endpoint"
     },
     "url": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://"
     },
     "description": {
      "type": "string"
     },
     "enabled_events": {
      "type": "array",
      "items": {
       "enum": [
        "order.paid",
        "order.refunded",
        "order.disputed",
        "order.dispute_resolved"
       ]
      }
     },
     "products": {
      "type": "array",
      "items": {
       "type": "string",
       "pattern": "^prod_[0-9A-HJKMNP-TV-Z]{26}$"
      }
     },
     "status": {
      "enum": [
       "enabled",
       "paused",
       "disabled"
      ]
     },
     "api_version": {
      "type": "string"
     },
     "return_url_domains": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "secret_prefix": {
      "type": [
       "string",
       "null"
      ]
     },
     "alert": {
      "type": [
       "string",
       "null"
      ]
     },
     "secret": {
      "type": "string",
      "pattern": "^whsec_",
      "description": "Só na criação e na rotação. Não se volta a mostrar."
     },
     "previous_secret_expires_at": {
      "type": "string"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "Z$"
     },
     "livemode": {
      "type": "boolean"
     }
    }
   },
   "DeletedWebhookEndpoint": {
    "type": "object",
    "required": [
     "id",
     "object",
     "deleted"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^we_[0-9A-HJKMNP-TV-Z]{26}$"
     },
     "object": {
      "const": "webhook_endpoint"
     },
     "deleted": {
      "const": true
     }
    }
   },
   "WebhookTest": {
    "type": "object",
    "required": [
     "object",
     "delivered",
     "outcome"
    ],
    "properties": {
     "object": {
      "const": "webhook_test"
     },
     "event": {
      "type": [
       "string",
       "null"
      ]
     },
     "delivered": {
      "type": "boolean"
     },
     "status_code": {
      "type": [
       "integer",
       "null"
      ]
     },
     "outcome": {
      "enum": [
       "entregue",
       "temporario",
       "configuracao",
       "definitivo",
       "queued"
      ]
     },
     "duration_ms": {
      "type": [
       "integer",
       "null"
      ]
     },
     "error": {
      "type": [
       "string",
       "null"
      ]
     },
     "response_excerpt": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   },
   "OrderEventData": {
    "type": "object",
    "required": [
     "order",
     "customer",
     "locale",
     "items",
     "metadata"
    ],
    "properties": {
     "order": {
      "type": "object",
      "required": [
       "id",
       "reference",
       "status",
       "amount",
       "currency",
       "refunded_amount",
       "full_refund",
       "paid_at",
       "provider",
       "provider_reference"
      ],
      "properties": {
       "id": {
        "type": "string",
        "pattern": "^ord_[0-9A-HJKMNP-TV-Z]{26}$"
       },
       "reference": {
        "type": "string"
       },
       "status": {
        "$ref": "#/components/schemas/OrderStatus"
       },
       "amount": {
        "type": "integer",
        "minimum": 0,
        "description": "Em subunidades da moeda (R 149,00 = 14900)."
       },
       "currency": {
        "type": "string",
        "pattern": "^[A-Z]{3}$",
        "description": "ISO 4217"
       },
       "refunded_amount": {
        "type": "integer",
        "minimum": 0,
        "description": "Em subunidades da moeda (R 149,00 = 14900)."
       },
       "full_refund": {
        "type": "boolean"
       },
       "paid_at": {
        "type": [
         "string",
         "null"
        ],
        "format": "date-time"
       },
       "created_at": {
        "type": "string",
        "format": "date-time",
        "pattern": "Z$"
       },
       "provider": {
        "type": [
         "string",
         "null"
        ]
       },
       "provider_reference": {
        "type": [
         "string",
         "null"
        ]
       },
       "livemode": {
        "type": "boolean"
       }
      }
     },
     "customer": {
      "$ref": "#/components/schemas/OrderCustomer"
     },
     "locale": {
      "enum": [
       "en",
       "pt",
       "es"
      ]
     },
     "items": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/OrderItem"
      }
     },
     "metadata": {
      "type": "object",
      "additionalProperties": {
       "type": [
        "string",
        "null"
       ]
      },
      "maxProperties": 51,
      "description": "Mapa de texto para texto, até 50 chaves. member_user_id vai sempre (null sem ref)."
     },
     "refund": {
      "type": "object",
      "properties": {
       "id": {
        "type": "string",
        "pattern": "^re_[0-9A-HJKMNP-TV-Z]{26}$"
       },
       "amount": {
        "type": "integer",
        "minimum": 0,
        "description": "Em subunidades da moeda (R 149,00 = 14900)."
       },
       "reason": {
        "type": [
         "string",
         "null"
        ]
       },
       "created_at": {
        "type": "string",
        "format": "date-time",
        "pattern": "Z$"
       }
      }
     },
     "dispute": {
      "type": "object",
      "properties": {
       "id": {
        "type": "string",
        "pattern": "^dp_[0-9A-HJKMNP-TV-Z]{26}$"
       },
       "reason": {
        "type": [
         "string",
         "null"
        ]
       },
       "amount": {
        "type": [
         "integer",
         "null"
        ]
       },
       "opened_at": {
        "type": "string",
        "format": "date-time",
        "pattern": "Z$"
       },
       "closed_at": {
        "type": "string",
        "format": "date-time",
        "pattern": "Z$"
       }
      }
     },
     "outcome": {
      "enum": [
       "won",
       "lost"
      ]
     }
    }
   },
   "Event.order.paid": {
    "type": "object",
    "required": [
     "id",
     "type",
     "api_version",
     "created_at",
     "livemode",
     "data"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$"
     },
     "type": {
      "const": "order.paid"
     },
     "api_version": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "Z$"
     },
     "livemode": {
      "type": "boolean"
     },
     "data": {
      "$ref": "#/components/schemas/OrderEventData"
     }
    }
   },
   "Event.order.refunded": {
    "type": "object",
    "required": [
     "id",
     "type",
     "api_version",
     "created_at",
     "livemode",
     "data"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$"
     },
     "type": {
      "const": "order.refunded"
     },
     "api_version": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "Z$"
     },
     "livemode": {
      "type": "boolean"
     },
     "data": {
      "allOf": [
       {
        "$ref": "#/components/schemas/OrderEventData"
       },
       {
        "required": [
         "refund"
        ]
       }
      ]
     }
    }
   },
   "Event.order.disputed": {
    "type": "object",
    "required": [
     "id",
     "type",
     "api_version",
     "created_at",
     "livemode",
     "data"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$"
     },
     "type": {
      "const": "order.disputed"
     },
     "api_version": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "Z$"
     },
     "livemode": {
      "type": "boolean"
     },
     "data": {
      "allOf": [
       {
        "$ref": "#/components/schemas/OrderEventData"
       },
       {
        "required": [
         "dispute"
        ]
       }
      ]
     }
    }
   },
   "Event.order.dispute_resolved": {
    "type": "object",
    "required": [
     "id",
     "type",
     "api_version",
     "created_at",
     "livemode",
     "data"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$"
     },
     "type": {
      "const": "order.dispute_resolved"
     },
     "api_version": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "Z$"
     },
     "livemode": {
      "type": "boolean"
     },
     "data": {
      "allOf": [
       {
        "$ref": "#/components/schemas/OrderEventData"
       },
       {
        "required": [
         "outcome",
         "dispute"
        ]
       }
      ]
     }
    }
   },
   "Event.integration.test": {
    "type": "object",
    "required": [
     "id",
     "type",
     "api_version",
     "created_at",
     "livemode",
     "data"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$"
     },
     "type": {
      "const": "integration.test"
     },
     "api_version": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "Z$"
     },
     "livemode": {
      "type": "boolean"
     },
     "data": {
      "type": "object",
      "required": [
       "message"
      ],
      "properties": {
       "message": {
        "type": "string"
       }
      }
     }
    }
   },
   "Event": {
    "oneOf": [
     {
      "$ref": "#/components/schemas/Event.order.paid"
     },
     {
      "$ref": "#/components/schemas/Event.order.refunded"
     },
     {
      "$ref": "#/components/schemas/Event.order.disputed"
     },
     {
      "$ref": "#/components/schemas/Event.order.dispute_resolved"
     }
    ]
   },
   "ProductList": {
    "type": "object",
    "required": [
     "object",
     "data",
     "has_more",
     "next_cursor"
    ],
    "properties": {
     "object": {
      "const": "list"
     },
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Product"
      }
     },
     "has_more": {
      "type": "boolean"
     },
     "next_cursor": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   },
   "OrderList": {
    "type": "object",
    "required": [
     "object",
     "data",
     "has_more",
     "next_cursor"
    ],
    "properties": {
     "object": {
      "const": "list"
     },
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Order"
      }
     },
     "has_more": {
      "type": "boolean"
     },
     "next_cursor": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   },
   "CustomerList": {
    "type": "object",
    "required": [
     "object",
     "data",
     "has_more",
     "next_cursor"
    ],
    "properties": {
     "object": {
      "const": "list"
     },
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Customer"
      }
     },
     "has_more": {
      "type": "boolean"
     },
     "next_cursor": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   },
   "RefundList": {
    "type": "object",
    "required": [
     "object",
     "data",
     "has_more",
     "next_cursor"
    ],
    "properties": {
     "object": {
      "const": "list"
     },
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Refund"
      }
     },
     "has_more": {
      "type": "boolean"
     },
     "next_cursor": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   },
   "CheckoutSessionList": {
    "type": "object",
    "required": [
     "object",
     "data",
     "has_more",
     "next_cursor"
    ],
    "properties": {
     "object": {
      "const": "list"
     },
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/CheckoutSession"
      }
     },
     "has_more": {
      "type": "boolean"
     },
     "next_cursor": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   },
   "WebhookEndpointList": {
    "type": "object",
    "required": [
     "object",
     "data",
     "has_more",
     "next_cursor"
    ],
    "properties": {
     "object": {
      "const": "list"
     },
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/WebhookEndpoint"
      }
     },
     "has_more": {
      "type": "boolean"
     },
     "next_cursor": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   },
   "EventList": {
    "type": "object",
    "required": [
     "object",
     "data",
     "has_more",
     "next_cursor"
    ],
    "properties": {
     "object": {
      "const": "list"
     },
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Event"
      }
     },
     "has_more": {
      "type": "boolean"
     },
     "next_cursor": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   }
  }
 }
}
