{
    "openapi": "3.1.0",
    "info": {
        "title": "Warya Shop Reseller API",
        "version": "1.0.0",
        "description": "Warya Shop customer API for catalog, wallet balance, player validation, orders and voucher delivery."
    },
    "servers": [
        {
            "url": "https://api.waryashop.org/api/v1",
            "description": "Warya Shop API v1"
        }
    ],
    "tags": [
        {
            "name": "Account"
        },
        {
            "name": "Catalog"
        },
        {
            "name": "Player"
        },
        {
            "name": "Orders"
        }
    ],
    "paths": {
        "/balance": {
            "get": {
                "tags": [
                    "Account"
                ],
                "summary": "Get wallet balance",
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Current balance",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BalanceResponse"
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimitLimit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimitRemaining"
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "x-scope": "balance:read"
            }
        },
        "/games": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "summary": "List active games and products",
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "default": 1
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 25
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "description": "Column to sort by. Prefix with \"-\" for descending. Only the columns this endpoint allow-lists are accepted; anything else falls back to the default.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "name",
                                "sort_order",
                                "code",
                                "-name",
                                "-sort_order",
                                "-code"
                            ]
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "description": "Match the name or the code.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "category",
                        "in": "query",
                        "description": "Filter by catalog category, for example topup or game-key.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Active catalog",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/GamesResponse"
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimitLimit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimitRemaining"
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "x-scope": "catalog:read"
            }
        },
        "/games/{code}/catalogue": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "summary": "List packages and sale prices",
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "code",
                        "in": "path",
                        "required": true,
                        "description": "Game or product code",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "default": 1
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 25
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "description": "Column to sort by. Prefix with \"-\" for descending. Only the columns this endpoint allow-lists are accepted; anything else falls back to the default.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "sale_price_usd",
                                "catalogue_name",
                                "id",
                                "-sale_price_usd",
                                "-catalogue_name",
                                "-id"
                            ]
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "description": "Match the item name.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "in_stock",
                        "in": "query",
                        "description": "Only items currently in stock.",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Game catalogue",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CatalogueResponse"
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimitLimit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimitRemaining"
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    },
                    "503": {
                        "$ref": "#/components/responses/TemporarilyUnavailable"
                    }
                },
                "x-scope": "catalog:read"
            }
        },
        "/games/{code}/fields": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "summary": "Get required order fields",
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "code",
                        "in": "path",
                        "required": true,
                        "description": "Game or product code",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Required fields",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/FieldsResponse"
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimitLimit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimitRemaining"
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    },
                    "503": {
                        "$ref": "#/components/responses/TemporarilyUnavailable"
                    }
                },
                "x-scope": "catalog:read"
            }
        },
        "/games/{code}/servers": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "summary": "Get available servers or regions",
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "code",
                        "in": "path",
                        "required": true,
                        "description": "Game or product code",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Server list",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ServersResponse"
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimitLimit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimitRemaining"
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    },
                    "503": {
                        "$ref": "#/components/responses/TemporarilyUnavailable"
                    }
                },
                "x-scope": "catalog:read"
            }
        },
        "/player/validate": {
            "post": {
                "tags": [
                    "Player"
                ],
                "summary": "Validate a player account",
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/PlayerValidationRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Player is valid",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlayerValidationResponse"
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimitLimit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimitRemaining"
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    },
                    "503": {
                        "$ref": "#/components/responses/TemporarilyUnavailable"
                    }
                },
                "x-scope": "players:validate"
            }
        },
        "/orders": {
            "post": {
                "tags": [
                    "Orders"
                ],
                "summary": "Create an order",
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "description": "A key for this order, scoped to your account: send the same key and the same body to retry safely, and a replay returns the first order with idempotent_replay set. The same key with a different body is a 409 for you; another account using the same string is that account's own key and does not collide with yours. Required when the key was issued with the strict contract.",
                        "schema": {
                            "type": "string",
                            "maxLength": 191
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CreateOrderRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Order accepted (or the first order of this Idempotency-Key replayed). A key created in sandbox mode answers a simulated order instead: order_id starts with SIM-, status is \"simulated\", charged is 0.000000, and sandbox/simulated are true — nothing is charged and nothing is sent to a supplier.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CreateOrderResponse"
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimitLimit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimitRemaining"
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest"
                    },
                    "402": {
                        "description": "Insufficient balance",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    },
                    "503": {
                        "$ref": "#/components/responses/TemporarilyUnavailable"
                    }
                },
                "x-scope": "orders:write"
            },
            "get": {
                "tags": [
                    "Orders"
                ],
                "summary": "List your orders",
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "default": 1
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 25
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "description": "Column to sort by. Prefix with \"-\" for descending. Only the columns this endpoint allow-lists are accepted; anything else falls back to the default.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "created_at",
                                "total_amount_usd",
                                "id",
                                "-created_at",
                                "-total_amount_usd",
                                "-id"
                            ]
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "description": "Only records created at or after this moment (ISO 8601).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "description": "Only records created at or before this moment (ISO 8601).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Filter by public status.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "processing",
                                "completed",
                                "failed",
                                "refunded"
                            ]
                        }
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "description": "Filter by order type.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "game_topup",
                                "product_voucher"
                            ]
                        }
                    },
                    {
                        "name": "game",
                        "in": "query",
                        "description": "Filter by the game or product code of the order item.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "customer_reference",
                        "in": "query",
                        "description": "Filter by the reference you sent.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Paginated orders",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/OrderListResponse"
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimitLimit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimitRemaining"
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "x-scope": "orders:read"
            }
        },
        "/orders/{orderId}": {
            "get": {
                "tags": [
                    "Orders"
                ],
                "summary": "Get one order",
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "orderId",
                        "in": "path",
                        "required": true,
                        "description": "Public order ID, for example WR-20260707-8F3KD",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Order details",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/OrderResponse"
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimitLimit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimitRemaining"
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "x-scope": "orders:read"
            }
        },
        "/transactions": {
            "get": {
                "tags": [
                    "Account"
                ],
                "summary": "List wallet transactions",
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "default": 1
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 25
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "description": "Column to sort by. Prefix with \"-\" for descending. Only the columns this endpoint allow-lists are accepted; anything else falls back to the default.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "created_at",
                                "amount",
                                "id",
                                "-created_at",
                                "-amount",
                                "-id"
                            ]
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "description": "Only records created at or after this moment (ISO 8601).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "description": "Only records created at or before this moment (ISO 8601).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "description": "Filter by transaction type, for example order_charge.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Filter by transaction status.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Paginated transactions",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TransactionListResponse"
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimitLimit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimitRemaining"
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "x-scope": "transactions:read"
            }
        }
    },
    "components": {
        "headers": {
            "RateLimitLimit": {
                "description": "Requests allowed in the current window: the key's own per-minute limit once authenticated, the deployment's per-address allowance before that.",
                "schema": {
                    "type": "integer",
                    "example": 60
                }
            },
            "RateLimitRemaining": {
                "description": "Requests left in the current window. When a route carries a stricter named budget as well (player validation), the smaller remainder is reported.",
                "schema": {
                    "type": "integer",
                    "example": 59
                }
            },
            "RateLimitReset": {
                "description": "Unix time at which the window frees up. Present on a 429, together with `Retry-After`.",
                "schema": {
                    "type": "integer",
                    "example": 1791622860
                }
            },
            "RetryAfter": {
                "description": "Seconds to wait before asking again. Present on a 429 and on a 503; `meta.retry_after` carries the same number in the body.",
                "schema": {
                    "type": "integer",
                    "example": 60
                }
            }
        },
        "securitySchemes": {
            "ApiKeyAuth": {
                "type": "apiKey",
                "in": "header",
                "name": "X-API-Key",
                "description": "Create a key on the API keys page of the Warya dashboard, or with `php artisan warya:make-api-key`. A key carries scopes, and it may only reach the endpoints those scopes cover: catalog:read, players:validate, balance:read, transactions:read, orders:read and orders:write. Each route names the one scope it needs, and a request whose key lacks it is a 403 that names the missing scope. Wallet funding is not part of this API: there is no deposit endpoint and no scope for one. A key may also restrict the addresses it answers from, and the application trusts no forwarded header, so that allow-list cannot be spoofed."
            }
        },
        "responses": {
            "Unauthorized": {
                "description": "Missing or invalid API key",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ErrorResponse"
                        }
                    }
                }
            },
            "Forbidden": {
                "description": "Account blocked, address not on the key's allow-list, or the key does not grant the scope the endpoint needs",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ErrorResponse"
                        }
                    }
                }
            },
            "NotFound": {
                "description": "Resource not found",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ErrorResponse"
                        }
                    }
                }
            },
            "BadRequest": {
                "description": "A required header is missing, for example Idempotency-Key",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ErrorResponse"
                        }
                    }
                }
            },
            "Conflict": {
                "description": "The Idempotency-Key was already used by this account for a different order",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ErrorResponse"
                        }
                    }
                }
            },
            "RateLimited": {
                "description": "Rate limit exceeded. The `Retry-After` header carries the number of seconds to wait, `X-RateLimit-Reset` the unix time the window frees up, and `meta.retry_after` repeats the wait for a client that reads only the body",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ErrorResponse"
                        }
                    }
                },
                "headers": {
                    "Retry-After": {
                        "$ref": "#/components/headers/RetryAfter"
                    },
                    "X-RateLimit-Limit": {
                        "$ref": "#/components/headers/RateLimitLimit"
                    },
                    "X-RateLimit-Remaining": {
                        "$ref": "#/components/headers/RateLimitRemaining"
                    },
                    "X-RateLimit-Reset": {
                        "$ref": "#/components/headers/RateLimitReset"
                    }
                }
            },
            "TemporarilyUnavailable": {
                "description": "The answer cannot be confirmed right now — the catalogue, an item's price or the service itself. Nothing was charged and no order was created. `Retry-After` (and `meta.retry_after`) carry the number of seconds to wait before asking again; the code is CATALOG_TEMPORARILY_UNAVAILABLE or SERVICE_TEMPORARILY_UNAVAILABLE",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ErrorResponse"
                        }
                    }
                }
            },
            "ValidationFailed": {
                "description": "Request validation failed",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ValidationErrorResponse"
                        }
                    }
                }
            }
        },
        "schemas": {
            "ErrorResponse": {
                "type": "object",
                "required": [
                    "success",
                    "error",
                    "error_code",
                    "message"
                ],
                "properties": {
                    "success": {
                        "type": "boolean",
                        "const": false
                    },
                    "error": {
                        "type": "object",
                        "required": [
                            "code",
                            "message"
                        ],
                        "description": "The same code and message as the top level, grouped for a client that reads the canonical envelope.",
                        "properties": {
                            "code": {
                                "type": "string",
                                "example": "INVALID_REQUEST"
                            },
                            "message": {
                                "type": "string"
                            }
                        }
                    },
                    "error_code": {
                        "type": "string",
                        "example": "INVALID_REQUEST"
                    },
                    "message": {
                        "type": "string"
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ResponseMeta"
                    }
                }
            },
            "ValidationErrorResponse": {
                "type": "object",
                "required": [
                    "success",
                    "error",
                    "error_code",
                    "message",
                    "errors"
                ],
                "properties": {
                    "success": {
                        "type": "boolean",
                        "const": false
                    },
                    "error": {
                        "type": "object",
                        "required": [
                            "code",
                            "message"
                        ],
                        "properties": {
                            "code": {
                                "type": "string",
                                "example": "VALIDATION_FAILED"
                            },
                            "message": {
                                "type": "string"
                            }
                        }
                    },
                    "error_code": {
                        "type": "string",
                        "example": "VALIDATION_FAILED"
                    },
                    "message": {
                        "type": "string",
                        "example": "The game field is required."
                    },
                    "errors": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "example": {
                            "game": [
                                "The game field is required."
                            ]
                        }
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ResponseMeta"
                    }
                }
            },
            "ResponseMeta": {
                "type": "object",
                "required": [
                    "request_id"
                ],
                "description": "Present on every response, success or failure. request_id equals the X-Request-Id header and identifies the api_logs row of the call.",
                "properties": {
                    "request_id": {
                        "type": "string",
                        "example": "01JQ8Z6V4T7C3N2M1K0P9R8S7Q"
                    }
                }
            },
            "BalanceResponse": {
                "type": "object",
                "required": [
                    "success",
                    "balance",
                    "locked_balance",
                    "currency",
                    "data",
                    "meta"
                ],
                "properties": {
                    "success": {
                        "type": "boolean",
                        "const": true
                    },
                    "balance": {
                        "type": "string",
                        "example": "25.500000"
                    },
                    "locked_balance": {
                        "type": "string",
                        "example": "0.000000"
                    },
                    "currency": {
                        "type": "string",
                        "example": "USD"
                    },
                    "data": {
                        "$ref": "#/components/schemas/BalanceData"
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ResponseMeta"
                    }
                }
            },
            "BalanceData": {
                "type": "object",
                "required": [
                    "balance",
                    "locked_balance",
                    "currency"
                ],
                "properties": {
                    "balance": {
                        "type": "string",
                        "example": "25.500000"
                    },
                    "locked_balance": {
                        "type": "string",
                        "example": "0.000000"
                    },
                    "currency": {
                        "type": "string",
                        "example": "USD"
                    }
                }
            },
            "GamesResponse": {
                "type": "object",
                "required": [
                    "success",
                    "games",
                    "data",
                    "meta"
                ],
                "properties": {
                    "success": {
                        "type": "boolean",
                        "const": true
                    },
                    "games": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Game"
                        }
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "games"
                        ],
                        "description": "The same keys, grouped, for a client that reads the canonical envelope.",
                        "properties": {
                            "games": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/Game"
                                }
                            }
                        }
                    },
                    "meta": {
                        "$ref": "#/components/schemas/PaginationMeta"
                    }
                }
            },
            "Game": {
                "type": "object",
                "properties": {
                    "code": {
                        "type": "string",
                        "example": "pubgm"
                    },
                    "name": {
                        "type": "string",
                        "example": "PUBG Mobile"
                    },
                    "image": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri"
                    },
                    "name_fa": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "category": {
                        "type": "string",
                        "example": "topup"
                    }
                }
            },
            "PlayerValidationResponse": {
                "type": "object",
                "required": [
                    "success",
                    "valid",
                    "data",
                    "meta"
                ],
                "properties": {
                    "success": {
                        "type": "boolean",
                        "const": true
                    },
                    "valid": {
                        "type": "boolean",
                        "const": true
                    },
                    "player_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "example": "ProGamer"
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "valid"
                        ],
                        "description": "The same keys, grouped, for a client that reads the canonical envelope.",
                        "properties": {
                            "game": {
                                "type": "string",
                                "example": "pubgm"
                            },
                            "valid": {
                                "type": "boolean",
                                "const": true
                            },
                            "player_name": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "example": "ProGamer"
                            }
                        }
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ResponseMeta"
                    }
                }
            },
            "PlayerValidationRequest": {
                "type": "object",
                "required": [
                    "game",
                    "player_id"
                ],
                "properties": {
                    "game": {
                        "type": "string",
                        "example": "pubgm"
                    },
                    "player_id": {
                        "type": "string",
                        "example": "12345678"
                    },
                    "server_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "charname": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "CreateOrderRequest": {
                "type": "object",
                "required": [
                    "game",
                    "catalogue_name"
                ],
                "properties": {
                    "game": {
                        "type": "string",
                        "example": "pubgm"
                    },
                    "catalogue_name": {
                        "type": "string",
                        "example": "60 UC"
                    },
                    "player_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "example": "12345678"
                    },
                    "server_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "charname": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "customer_reference": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 191
                    },
                    "callback_url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri",
                        "maxLength": 500
                    }
                }
            },
            "CreateOrderResponse": {
                "type": "object",
                "required": [
                    "success",
                    "order_id",
                    "status",
                    "charged",
                    "currency",
                    "idempotent_replay",
                    "data",
                    "meta"
                ],
                "properties": {
                    "success": {
                        "type": "boolean",
                        "const": true
                    },
                    "order_id": {
                        "type": "string",
                        "example": "WR-20260707-8F3KD"
                    },
                    "status": {
                        "type": "string",
                        "example": "processing"
                    },
                    "charged": {
                        "type": "string",
                        "example": "0.950000",
                        "description": "A decimal string, never a JSON number."
                    },
                    "currency": {
                        "type": "string",
                        "example": "USD"
                    },
                    "idempotent_replay": {
                        "type": "boolean",
                        "description": "True when this answer is the order a previous request with the same Idempotency-Key created. Nothing was charged again."
                    },
                    "sandbox": {
                        "type": "boolean",
                        "description": "true when the key that made this call is a sandbox key, meaning the order is simulated: order_id starts with SIM-, status is \"simulated\", charged is 0.000000 and no money moved. Absent on a production key."
                    },
                    "simulated": {
                        "type": "boolean",
                        "description": "Same meaning as `sandbox`, repeated for a client that reads only one of the two names."
                    },
                    "data": {
                        "type": "object",
                        "description": "The same fields, grouped, for a client that reads the canonical envelope."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ResponseMeta"
                    }
                }
            },
            "Order": {
                "type": "object",
                "properties": {
                    "order_id": {
                        "type": "string",
                        "example": "WR-20260707-8F3KD"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "processing",
                            "completed",
                            "failed",
                            "refunded"
                        ],
                        "example": "processing"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "game_topup",
                            "product_voucher"
                        ],
                        "example": "game_topup"
                    },
                    "game": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "example": "pubgm"
                    },
                    "catalogue_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "example": "60 UC"
                    },
                    "player_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "server_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "total_amount": {
                        "type": "string",
                        "example": "0.950000"
                    },
                    "currency": {
                        "type": "string",
                        "example": "USD"
                    },
                    "customer_reference": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "delivery": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "Present only for a completed voucher order.",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "example": {
                            "code": "ABC-1234-XYZ"
                        }
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "OrderResponse": {
                "type": "object",
                "required": [
                    "success",
                    "order",
                    "data",
                    "meta"
                ],
                "properties": {
                    "success": {
                        "type": "boolean",
                        "const": true
                    },
                    "order": {
                        "$ref": "#/components/schemas/Order"
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "order"
                        ],
                        "description": "The same keys, grouped, for a client that reads the canonical envelope.",
                        "properties": {
                            "order": {
                                "$ref": "#/components/schemas/Order"
                            }
                        }
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ResponseMeta"
                    }
                }
            },
            "OrderListResponse": {
                "type": "object",
                "required": [
                    "success",
                    "orders",
                    "data",
                    "meta"
                ],
                "properties": {
                    "success": {
                        "type": "boolean",
                        "const": true
                    },
                    "orders": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Order"
                        }
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "orders"
                        ],
                        "description": "The same keys, grouped, for a client that reads the canonical envelope.",
                        "properties": {
                            "orders": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/Order"
                                }
                            }
                        }
                    },
                    "meta": {
                        "$ref": "#/components/schemas/PaginationMeta"
                    }
                }
            },
            "CatalogueResponse": {
                "type": "object",
                "required": [
                    "success",
                    "game",
                    "game_name",
                    "catalogue",
                    "data",
                    "meta"
                ],
                "properties": {
                    "success": {
                        "type": "boolean",
                        "const": true
                    },
                    "game": {
                        "type": "string",
                        "example": "pubgm"
                    },
                    "game_name": {
                        "type": "string",
                        "example": "PUBG Mobile"
                    },
                    "catalogue": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/CatalogueItem"
                        }
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "game",
                            "catalogue"
                        ],
                        "description": "The same keys, grouped, for a client that reads the canonical envelope.",
                        "properties": {
                            "game": {
                                "type": "string"
                            },
                            "game_name": {
                                "type": "string"
                            },
                            "catalogue": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/CatalogueItem"
                                }
                            }
                        }
                    },
                    "meta": {
                        "$ref": "#/components/schemas/PaginationMeta"
                    }
                }
            },
            "CatalogueItem": {
                "type": "object",
                "required": [
                    "catalogue_name",
                    "sale_price_usd",
                    "currency",
                    "stock_status"
                ],
                "properties": {
                    "catalogue_name": {
                        "type": "string",
                        "example": "60 UC",
                        "description": "Send exactly this string as `catalogue_name` when creating an order."
                    },
                    "sale_price_usd": {
                        "type": "string",
                        "example": "0.950000",
                        "description": "A decimal string, never a JSON number. The price an order for this item is charged at the moment it is read, so a quote taken from this answer and an order submitted from it agree."
                    },
                    "sale_price": {
                        "type": "string",
                        "example": "0.950000",
                        "description": "The same figure as `sale_price_usd`."
                    },
                    "currency": {
                        "type": "string",
                        "example": "USD"
                    },
                    "stock_status": {
                        "type": "string",
                        "example": "in_stock",
                        "description": "The supplier's own word for this package, passed through unchanged. It is not the answer to \"can this be ordered\": read `availability` for that."
                    },
                    "availability": {
                        "type": "string",
                        "enum": [
                            "https://schema.org/InStock",
                            "https://schema.org/OutOfStock",
                            "https://schema.org/PreOrder"
                        ],
                        "example": "https://schema.org/InStock",
                        "description": "Whether this package can be ordered right now, in schema.org's vocabulary. `InStock` is the only value an order is accepted for; `OutOfStock` and `PreOrder` are listed with their real price and refused at checkout. `?in_stock=1` returns exactly the `InStock` rows."
                    },
                    "eta_label": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "kind": {
                        "type": "string",
                        "example": "topup"
                    },
                    "face_value": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "FieldsResponse": {
                "type": "object",
                "required": [
                    "success",
                    "game",
                    "fields",
                    "data",
                    "meta"
                ],
                "properties": {
                    "success": {
                        "type": "boolean",
                        "const": true
                    },
                    "game": {
                        "type": "string",
                        "example": "pubgm"
                    },
                    "fields": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "example": [
                            "player_id"
                        ]
                    },
                    "notes": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "game",
                            "fields"
                        ],
                        "description": "The same keys, grouped, for a client that reads the canonical envelope.",
                        "properties": {
                            "game": {
                                "type": "string"
                            },
                            "fields": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "notes": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ProvenanceMeta"
                    }
                }
            },
            "ServersResponse": {
                "type": "object",
                "required": [
                    "success",
                    "game",
                    "servers",
                    "data",
                    "meta"
                ],
                "properties": {
                    "success": {
                        "type": "boolean",
                        "const": true
                    },
                    "game": {
                        "type": "string",
                        "example": "pubgm"
                    },
                    "servers": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "required": [
                                "id",
                                "name"
                            ],
                            "properties": {
                                "id": {
                                    "type": "string",
                                    "example": "1"
                                },
                                "name": {
                                    "type": "string",
                                    "example": "Server 1"
                                }
                            }
                        }
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "game",
                            "servers"
                        ],
                        "description": "The same keys, grouped, for a client that reads the canonical envelope.",
                        "properties": {
                            "game": {
                                "type": "string"
                            },
                            "servers": {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ProvenanceMeta"
                    }
                }
            },
            "ProvenanceMeta": {
                "type": "object",
                "required": [
                    "request_id",
                    "source",
                    "freshness",
                    "stale",
                    "generated_at",
                    "retry_after"
                ],
                "description": "Where an answer that depends on a confirmation came from: `live` when it was received during this request, `recorded` when it is one verified earlier; `stale` repeats that as a boolean, `generated_at` is the moment of verification, and `retry_after` is null while the answer is current.",
                "properties": {
                    "request_id": {
                        "type": "string"
                    },
                    "source": {
                        "type": "string",
                        "enum": [
                            "live",
                            "recorded"
                        ]
                    },
                    "freshness": {
                        "type": "string",
                        "enum": [
                            "fresh",
                            "stale"
                        ]
                    },
                    "stale": {
                        "type": "boolean"
                    },
                    "generated_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "retry_after": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    }
                }
            },
            "PaginationMeta": {
                "type": "object",
                "required": [
                    "current_page",
                    "last_page",
                    "per_page",
                    "total",
                    "count",
                    "request_id"
                ],
                "properties": {
                    "current_page": {
                        "type": "integer",
                        "example": 1
                    },
                    "last_page": {
                        "type": "integer",
                        "example": 3
                    },
                    "per_page": {
                        "type": "integer",
                        "maximum": 100,
                        "example": 25
                    },
                    "total": {
                        "type": "integer",
                        "example": 61
                    },
                    "count": {
                        "type": "integer",
                        "description": "Items in this page.",
                        "example": 25
                    },
                    "has_more": {
                        "type": "boolean",
                        "description": "Present on the catalog endpoints, where the default page is the whole list."
                    },
                    "request_id": {
                        "type": "string"
                    }
                }
            },
            "Transaction": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 1024
                    },
                    "type": {
                        "type": "string",
                        "example": "order_charge"
                    },
                    "amount": {
                        "type": "string",
                        "example": "-0.950000"
                    },
                    "balance_before": {
                        "type": "string",
                        "example": "25.500000"
                    },
                    "balance_after": {
                        "type": "string",
                        "example": "24.550000"
                    },
                    "status": {
                        "type": "string",
                        "example": "success"
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "TransactionListResponse": {
                "type": "object",
                "required": [
                    "success",
                    "transactions",
                    "data",
                    "meta"
                ],
                "properties": {
                    "success": {
                        "type": "boolean",
                        "const": true
                    },
                    "transactions": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Transaction"
                        }
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "transactions"
                        ],
                        "description": "The same keys, grouped, for a client that reads the canonical envelope.",
                        "properties": {
                            "transactions": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/Transaction"
                                }
                            }
                        }
                    },
                    "meta": {
                        "$ref": "#/components/schemas/PaginationMeta"
                    }
                }
            }
        }
    }
}