{
  "openapi": "3.1.0",
  "info": {
    "title": "9aipay 开发者 API",
    "version": "1.0.0",
    "description": "所有已注册并启用的代理均可在代理后台开发者中心创建密钥。接口只访问密钥归属代理的资源；服务端调用，密钥不应放入网页、URL、日志或公开仓库。每密钥每分钟 300 次。两种认证格式任选其一，不要提交冲突的认证值。旧版静态只读 API 的独立凭据不适用于此接口。 卡片日常操作需按需勾选 cards:operate，旧密钥不自动增加权限。响应 X-Request-Id 可用于排查，API 调用日志不保存正文、密钥和完整卡号。"
  },
  "servers": [
    {
      "url": "https://api.9aipay.com/openapi/v1"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "资金"
    },
    {
      "name": "目录"
    },
    {
      "name": "开卡订单"
    },
    {
      "name": "卡片"
    },
    {
      "name": "持卡人与批量开卡"
    }
  ],
  "paths": {
    "/wallet": {
      "get": {
        "summary": "查询自己的账户余额",
        "operationId": "get_wallet",
        "tags": [
          "资金"
        ],
        "x-required-scope": "read",
        "description": "availableBalance 为当前可用余额；frozenBalance 为订单占用的冻结余额。",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Wallet"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/catalog/card-types": {
      "get": {
        "summary": "查询卡类型与开卡能力",
        "operationId": "get_catalog_card_types",
        "tags": [
          "目录"
        ],
        "x-required-scope": "read",
        "description": "开卡使用 items 中的 id，检查 usageModes、minPrincipal 和 availableForIssuance。目录不提供当前账户费用，费用必须调用报价接口取得。",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "rulesVersion": {
                          "type": "integer"
                        },
                        "currency": {
                          "const": "USD"
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "brand": {
                                "type": "string"
                              },
                              "usageModes": {
                                "type": "array",
                                "items": {
                                  "enum": [
                                    "single",
                                    "multi",
                                    "prepaid"
                                  ]
                                }
                              },
                              "defaultSubscriptionLimit": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "description": "普通储值卡为 null，不表示无限次授权承诺。"
                              },
                              "minPrincipal": {
                                "type": "string",
                                "description": "该产品当前最低首次转入金额，USD 字符串；下单前重新读取目录与报价。"
                              },
                              "availableForIssuance": {
                                "type": "boolean"
                              }
                            }
                          }
                        }
                      },
                      "required": [
                        "rulesVersion",
                        "currency",
                        "items"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/cards": {
      "get": {
        "summary": "分页查询自己的卡片",
        "operationId": "get_cards",
        "tags": [
          "卡片"
        ],
        "x-required-scope": "read",
        "description": "分页查询自己的卡片",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Card"
                          }
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "nextCursor"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "name": "source",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "local"
              ]
            },
            "description": "local 仅读取本账户已有卡片快照，不等待卡商查询。余额以 providerBalanceUpdatedAt 为准，缺失不代表零。省略时保留原同步行为。"
          }
        ]
      }
    },
    "/cards/{cardId}": {
      "get": {
        "summary": "查询单张卡片",
        "operationId": "get_cards_cardId",
        "tags": [
          "卡片"
        ],
        "x-required-scope": "read",
        "description": "仅返回当前代理卡片的尾号及元数据。完整资料使用独立 reveal 接口。",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "card": {
                          "$ref": "#/components/schemas/Card"
                        },
                        "subscriptions": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        },
                        "transactions": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Transaction"
                          }
                        },
                        "credentialRevealAvailable": {
                          "type": "boolean"
                        },
                        "operationCapabilities": {
                          "$ref": "#/components/schemas/CardOperationCapabilities"
                        },
                        "operations": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CardOperation"
                          }
                        }
                      },
                      "required": [
                        "card",
                        "subscriptions",
                        "transactions",
                        "credentialRevealAvailable",
                        "operationCapabilities",
                        "operations"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在，或不属于当前代理。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/CardId"
          }
        ]
      }
    },
    "/cards/{cardId}/transactions": {
      "get": {
        "summary": "查询卡片交易记录",
        "operationId": "get_cards_cardId_transactions",
        "tags": [
          "卡片"
        ],
        "x-required-scope": "read",
        "description": "返回该账户名下指定卡片最近最多 100 条已同步交易。读取会尝试同步最新记录；检查 coverage/source/live 等覆盖信息，不将单次读取当作完整实时历史。",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/CardTransactionPage"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "cardId": {
                              "type": "integer",
                              "minimum": 1
                            }
                          },
                          "required": [
                            "cardId"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在，或不属于当前代理。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/CardId"
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "local"
              ]
            },
            "description": "local 仅读取本地已同步或收到通知的记录，不发起卡商查询；不代表完整历史。与 statsMonth/metric 组合时仍按本地月份/分类过滤，coverage 为 partial。"
          }
        ]
      }
    },
    "/cards/{cardId}/reveal": {
      "post": {
        "summary": "按需获取自己卡片的完整资料",
        "operationId": "post_cards_cardId_reveal",
        "tags": [
          "卡片"
        ],
        "x-required-scope": "cards:reveal",
        "description": "需要独立 cards:reveal 权限，且卡片属于此密钥的代理。仅按需读取；响应带 no-store。expiresAt 为 60 秒后的展示截止时间，不是卡片失效时间。客户端应到期清除，不应写入日志或持久缓存。另受每账户每分钟 30 次限制。",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/CardCredentials"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在，或不属于当前代理。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键与原请求内容冲突，或当前资源状态不支持此操作。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "暂未取得可用卡资料。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务或正式发卡暂不可用；开卡请求应使用原幂等键查询或重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/CardId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/card-orders": {
      "get": {
        "summary": "分页查询自己的开卡订单",
        "operationId": "get_card_orders",
        "tags": [
          "开卡订单"
        ],
        "x-required-scope": "read",
        "description": "分页查询自己的开卡订单",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CardOrder"
                          }
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "nextCursor"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ]
      },
      "post": {
        "summary": "创建开卡订单并发起开卡",
        "operationId": "post_card_orders",
        "tags": [
          "开卡订单"
        ],
        "x-required-scope": "cards:issue",
        "description": "使用当前代理余额和专属费用，与网页开卡共用订单、冻结和结算。HTTP 201 只表示订单已创建，必须检查 order.status。成功后扣款；结果不明时保持冻结，勿用新幂等键重试。普通储值卡一单一张，单次申请自动触发首次转入；卡交付但首充待确认时订单不会完成。建议将报价响应中的 rulesVersion 和 customerTotal 原样放入可选 confirmedQuote；新单报价不一致返回 409 quote_changed，不创建订单或冻结金额。已有同键、同业务参数的原订单优先重放，不受当前报价变化影响；不传 confirmedQuote 的旧请求保持兼容。 新申请仅支持 usageMode=prepaid，不接受 expiry 或 subscriptionLimit。旧订单仍可使用原幂等键和完全相同的原业务参数重放；该兼容只返回原订单，不开放旧产品的新申请。",
        "responses": {
          "200": {
            "description": "已返回原订单（幂等重放）。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "order": {
                          "$ref": "#/components/schemas/CardOrder"
                        },
                        "card": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Card"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "wallet": {
                          "$ref": "#/components/schemas/Wallet"
                        },
                        "replay": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "order",
                        "card",
                        "wallet"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "已创建订单。开卡是否成功须读取 data.order.status。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "order": {
                          "$ref": "#/components/schemas/CardOrder"
                        },
                        "card": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Card"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "wallet": {
                          "$ref": "#/components/schemas/Wallet"
                        },
                        "replay": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "order",
                        "card",
                        "wallet"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键与原业务参数冲突，或新单 confirmedQuote 与当前报价不同（quote_changed）；报价变化不会创建订单或冻结金额，应重新报价并让客户确认。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "可用余额不足等业务校验失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务或正式发卡暂不可用；开卡请求应使用原幂等键查询或重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CardOrderInput"
              }
            }
          }
        }
      }
    },
    "/card-orders/{orderId}": {
      "get": {
        "summary": "按订单号查询开卡结果",
        "operationId": "get_card_orders_orderId",
        "tags": [
          "开卡订单"
        ],
        "x-required-scope": "read",
        "description": "可直接查询历史订单，不受列表分页范围限制。unknown_frozen 时继续查询原订单，勿更换幂等键重新开卡。",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "order": {
                          "$ref": "#/components/schemas/CardOrder"
                        }
                      },
                      "required": [
                        "order"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在，或不属于当前代理。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/OrderId"
          }
        ]
      }
    },
    "/card-orders/quote": {
      "post": {
        "summary": "计算本代理的开卡报价",
        "operationId": "post_card_orders_quote",
        "tags": [
          "开卡订单"
        ],
        "x-required-scope": "read",
        "description": "仅报价，不冻结、不扣款、不开卡。按当前代理等级和已发布费用计算。 先读取目录确认产品 usageModes、minPrincipal 和 availableForIssuance。 新申请仅支持 usageMode=prepaid 普通储值卡，首次转入至少 5.00 USD。",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Quote"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "可用余额不足等业务校验失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteInput"
              }
            }
          }
        }
      }
    },
    "/ledger": {
      "get": {
        "summary": "查询自己的账户资金流水",
        "operationId": "get_ledger",
        "tags": [
          "资金"
        ],
        "x-required-scope": "read",
        "description": "只查询当前客户的本地 USD 资金流水；包含账户入账、开卡、卡资金操作和冻结释放。按创建时间倒序，同时间按本地 ID 倒序。无查询参数默认最近 100 条；带筛选或分页参数默认每页 20 条，最大 100。筛选后的 total、hasMore 和 nextOffset 可继续查询第 101 条及之后的记录。未知、重复、空值或非法查询参数返回 400 invalid_input。分页是本地当前记录的实时视图，翻页期间新增记录可能改变 offset；调用方应按 ID 去重，必要时刷新第一页。",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/LedgerEntry"
                          }
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "当前租户筛选后的总条数。"
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        },
                        "offset": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "hasMore": {
                          "type": "boolean"
                        },
                        "nextOffset": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "有后续记录时为下一页 offset，否则为 null。"
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "limit",
                        "offset",
                        "hasMore",
                        "nextOffset"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "按本地流水类型精确匹配；合法但没有记录的类型返回空页。",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$",
              "examples": [
                "topup",
                "card_order_hold",
                "card_operation_settle",
                "card_withdraw_credit",
                "card_cancel_refund_credit"
              ]
            }
          },
          {
            "name": "direction",
            "in": "query",
            "required": false,
            "description": "按实际账本金额筛选：正数 credit、负数 debit、零 neutral。冻结与释放的零金额流水属于 neutral。",
            "schema": {
              "type": "string",
              "enum": [
                "credit",
                "debit",
                "neutral"
              ]
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "description": "北京时间（Asia/Shanghai）起始自然日，包含当天 00:00:00。",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "description": "北京时间结束自然日，包含当天；必须不早于 startDate。",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "每页条数；有查询参数时默认 20，完全无查询参数时兼容默认 100。",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "已跳过的记录数；使用上一页返回的 nextOffset 继续查询。",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991,
              "default": 0
            }
          }
        ]
      }
    },
    "/topup-orders": {
      "get": {
        "summary": "查询自己的充值申请",
        "operationId": "get_topup_orders",
        "tags": [
          "资金"
        ],
        "x-required-scope": "read",
        "description": "只查询当前客户的本地账户充值申请；账户充值与卡片资金操作分别查询。按创建时间倒序，同时间按本地 ID 倒序。无查询参数默认最近 100 条；带筛选或分页参数默认每页 20 条，最大 100。筛选后的 total、hasMore 和 nextOffset 可继续查询第 101 条及之后的记录。未知、重复、空值或非法查询参数返回 400 invalid_input。分页是本地当前记录的实时视图，翻页期间新增记录可能改变 offset；调用方应按 ID 去重，必要时刷新第一页。",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/TopupOrder"
                          }
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "当前租户筛选后的总条数。"
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        },
                        "offset": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "hasMore": {
                          "type": "boolean"
                        },
                        "nextOffset": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "有后续记录时为下一页 offset，否则为 null。"
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "limit",
                        "offset",
                        "hasMore",
                        "nextOffset"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "充值申请状态；链上候选、超时等 payment 状态不会代替订单 status。",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "paid",
                "failed"
              ]
            }
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "description": "账户充值付款方式，对应记录的 provider 字段。",
            "schema": {
              "type": "string",
              "enum": [
                "manual",
                "usdt_trc20",
                "usdt_okx_trc20",
                "usdt_okx_internal"
              ]
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "description": "北京时间（Asia/Shanghai）起始自然日，包含当天 00:00:00。",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "description": "北京时间结束自然日，包含当天；必须不早于 startDate。",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "每页条数；有查询参数时默认 20，完全无查询参数时兼容默认 100。",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "已跳过的记录数；使用上一页返回的 nextOffset 继续查询。",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991,
              "default": 0
            }
          }
        ]
      },
      "post": {
        "summary": "创建账户充值申请",
        "operationId": "post_topup_orders",
        "tags": [
          "资金"
        ],
        "x-required-scope": "topups:create",
        "description": "Creates a pending manual or USDT TRC20 topup, or an OKX internal topup. Read GET /topup-methods first and pass an available method ID as mode. For new payments between OKX users, prefer usdt_okx_internal when returned. USDT invoices lock published fees and live FX for 30 minutes. Manual-chain mode: Chain evidence never credits the wallet: an administrator independently confirms Binance receipt and payer ownership. Reuse the same Idempotency-Key to replay the original invoice even if the provider is currently unavailable. Internal orders return only order.okxInternal: use its fixed recipientUid and exact payableAmount, including matchingAdjustmentAmount, in OKX Withdraw > OKX users. Do not send a recipient UID in the request, generate a blockchain QR or submit a TXID. Poll GET /topup-orders/{orderId}; only status=paid with creditMethod=okx_internal_auto confirms automatic internal credit. New usdt_okx_trc20 invoices may opt into automatic credit only when the method and immutable order expose automaticCredit=true; this requires final OKX receipt, independent chain evidence and unique order binding. Old invoices retain their original method and payment instructions.",
        "responses": {
          "200": {
            "description": "已返回原订单（幂等重放）。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "order": {
                          "$ref": "#/components/schemas/TopupOrder"
                        },
                        "currency": {
                          "const": "USD"
                        },
                        "balance": {
                          "type": "string",
                          "pattern": "^-?\\d+\\.\\d{2}$",
                          "examples": [
                            "15.00"
                          ]
                        },
                        "availableBalance": {
                          "type": "string",
                          "pattern": "^-?\\d+\\.\\d{2}$",
                          "examples": [
                            "15.00"
                          ]
                        },
                        "frozenBalance": {
                          "type": "string",
                          "pattern": "^-?\\d+\\.\\d{2}$",
                          "examples": [
                            "15.00"
                          ]
                        },
                        "replay": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "order"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "已创建订单。开卡是否成功须读取 data.order.status。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "order": {
                          "$ref": "#/components/schemas/TopupOrder"
                        },
                        "currency": {
                          "const": "USD"
                        },
                        "balance": {
                          "type": "string",
                          "pattern": "^-?\\d+\\.\\d{2}$",
                          "examples": [
                            "15.00"
                          ]
                        },
                        "availableBalance": {
                          "type": "string",
                          "pattern": "^-?\\d+\\.\\d{2}$",
                          "examples": [
                            "15.00"
                          ]
                        },
                        "frozenBalance": {
                          "type": "string",
                          "pattern": "^-?\\d+\\.\\d{2}$",
                          "examples": [
                            "15.00"
                          ]
                        },
                        "replay": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "order"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键与原请求内容冲突，或当前资源状态不支持此操作。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "可用余额不足等业务校验失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TopupInput"
              }
            }
          }
        }
      }
    },
    "/topup-methods": {
      "get": {
        "operationId": "get_topup_methods",
        "summary": "Available topup methods",
        "x-required-scope": "read",
        "description": "Read before creating a new topup. Only methods returned here are currently available. Use data.defaultMethod when present and listed; the current server prefers usdt_okx_internal when ready, otherwise manual. Then use the created order's fixed payment instructions. Listing methods reads cached readiness; it neither creates an invoice nor proves a payment. Never change an existing invoice to a newly available method.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "methods": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "enum": [
                                  "manual",
                                  "usdt_trc20",
                                  "usdt_okx_trc20",
                                  "usdt_okx_internal"
                                ]
                              },
                              "label": {
                                "type": "string"
                              },
                              "automaticCredit": {
                                "type": "boolean",
                                "description": "当前方法是否可为新订单提供自动核验；按方法读取，以订单自身标记为准。"
                              }
                            }
                          }
                        },
                        "defaultMethod": {
                          "type": "string",
                          "enum": [
                            "manual",
                            "usdt_trc20",
                            "usdt_okx_trc20",
                            "usdt_okx_internal"
                          ],
                          "description": "可选的服务端推荐新单方式，值必须存在于 methods；内部渠道就绪时优先 usdt_okx_internal，否则 manual。调用方仍须将其显式传入创建请求的 mode；省略 mode 继续按 manual 处理。"
                        },
                        "usdt": {
                          "type": [
                            "object",
                            "null"
                          ]
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/topup-orders/{orderId}/payment": {
      "post": {
        "operationId": "check_topup_payment",
        "summary": "Check a TRON transaction for an owned topup invoice",
        "description": "Requires a pending USDT order using a blockchain method. Querying a TXID never credits the wallet or proves payer ownership. usdt_okx_internal orders do not use a blockchain TXID and reject this endpoint with 409; poll GET /topup-orders/{orderId} instead.",
        "x-required-scope": "topups:create",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "txId"
                ],
                "additionalProperties": false,
                "properties": {
                  "txId": {
                    "type": "string",
                    "pattern": "^[a-fA-F0-9]{64}$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "order": {
                          "$ref": "#/components/schemas/TopupOrder"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Order not owned by caller"
          },
          "409": {
            "description": "Order not pending, internal order does not accept TXID claims, or transaction not confirmed"
          },
          "422": {
            "description": "Transaction failed validation"
          },
          "429": {
            "description": "Lookup rate limited"
          },
          "503": {
            "description": "Feature disabled or lookup unavailable; do not infer payment was not received"
          }
        }
      }
    },
    "/card-orders/{orderId}/reconcile": {
      "post": {
        "summary": "核对自己的原开卡订单",
        "operationId": "post_card_orders_orderId_reconcile",
        "tags": [
          "开卡订单"
        ],
        "x-required-scope": "cards:issue",
        "description": "只按原请求号查询并核对原订单，不重新申请卡片、不追加首充。系统核实处理结果后更新原订单；结果未知时保留冻结。",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "order": {
                          "$ref": "#/components/schemas/CardOrder"
                        }
                      },
                      "required": [
                        "order"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在，或不属于当前代理。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "当前卡片或订单状态不支持此操作。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/OrderId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              },
              "example": {}
            }
          }
        }
      }
    },
    "/cards/balance-summary": {
      "get": {
        "summary": "查询自己的卡内余额汇总",
        "operationId": "get_cards_balance_summary",
        "tags": [
          "卡片"
        ],
        "x-required-scope": "read",
        "description": "核对已同步的卡片余额后按币种汇总。只统计当前账户的卡片；检查 status、覆盖张数及 checkedAt。",
        "parameters": [],
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/CardBalanceSummary"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在，或不属于当前代理。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/card-transactions": {
      "get": {
        "summary": "查询自己的卡片交易",
        "operationId": "get_card_transactions",
        "tags": [
          "卡片"
        ],
        "x-required-scope": "read",
        "description": "仅查询当前账户的卡片及其所属交易，支持过滤与 offset 分页。日期按 Asia/Shanghai 自然日，endDate 包含当日。读取会尝试同步最新记录；覆盖范围由响应声明。 statsMonth 与 metric 成对传入时，读取与月统计同口径的账户月快照并支持现有筛选、分页；检查 coverage、checkedAt、reason，partial 不能当作全月总量。此范围可返回 usdDisplayAmount（USD 展示金额），不是实际结算金额；不从普通本地历史推断完整月份。 可选 source=local 用于接收通知后的页面刷新，只读本地记录，保留筛选和分页，不调用卡商。",
        "parameters": [
          {
            "name": "cardId",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "last4",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}$"
            }
          },
          {
            "name": "merchant",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          },
          {
            "name": "transactionId",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "$ref": "#/components/parameters/StatisticsMonth"
          },
          {
            "$ref": "#/components/parameters/StatisticsMetric"
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "local"
              ]
            },
            "description": "local 仅读取本地已同步或收到通知的记录，不发起卡商查询；不代表完整历史。与 statsMonth/metric 组合时仍按本地月份/分类过滤，coverage 为 partial。"
          }
        ],
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/CardTransactionPage"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在，或不属于当前代理。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/cards/{id}/operations": {
      "post": {
        "summary": "账户余额转入普通储值卡、冻结或解冻",
        "operationId": "create_card_operation",
        "tags": [
          "卡片"
        ],
        "x-required-scope": "cards:operate",
        "description": "需要独立 cards:operate，旧密钥不会自动获得此权限。仅普通储值卡，是否开放以卡片返回的 operationCapabilities 为准。账户余额等额 USD 转入，额外服务费 0，不重复收账户充值费。携带最新卡片 version；同一笔重试保留原 Idempotency-Key 与完整请求。pending/processing 等待处理结果确认；unknown/unknown_frozen 核对原单，勿换新键重复提交。",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CardOperationInput"
              },
              "examples": {
                "recharge": {
                  "value": {
                    "type": "recharge",
                    "amount": "10.00",
                    "version": 0
                  }
                },
                "freeze": {
                  "value": {
                    "type": "freeze",
                    "version": 0
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "同一请求幂等重放原操作单。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "operation": {
                          "$ref": "#/components/schemas/CardOperation"
                        },
                        "replay": {
                          "type": "boolean"
                        },
                        "wallet": {
                          "$ref": "#/components/schemas/Wallet"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "操作单已创建，未必已完成。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "operation": {
                          "$ref": "#/components/schemas/CardOperation"
                        },
                        "replay": {
                          "type": "boolean"
                        },
                        "wallet": {
                          "$ref": "#/components/schemas/Wallet"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在，或不属于当前代理。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "卡片版本冲突、操作处理中或幂等键内容冲突。"
          },
          "422": {
            "description": "账户可用余额不足。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "当前卡片操作尚未开放或服务暂不可用；查询原操作状态，勿换新键重复提交。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/card-operations": {
      "get": {
        "summary": "查询自己的卡片操作单",
        "operationId": "list_card_operations",
        "tags": [
          "卡片"
        ],
        "x-required-scope": "read",
        "parameters": [
          {
            "name": "cardId",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CardOperation"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在，或不属于当前代理。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/card-operations/{id}": {
      "get": {
        "summary": "查询自己的原卡片操作单",
        "operationId": "get_card_operation",
        "tags": [
          "卡片"
        ],
        "x-required-scope": "read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "cop_example"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "operation": {
                          "$ref": "#/components/schemas/CardOperation"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在，或不属于当前代理。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/card-transactions/export": {
      "get": {
        "summary": "导出普通或月统计范围交易（CSV）",
        "operationId": "export_card_transactions",
        "tags": [
          "卡片"
        ],
        "x-required-scope": "read",
        "description": "筛选条件同 GET /card-transactions，不接受 limit/offset。普通查询仅导出本地已同步记录；statsMonth 与 metric 成对传入时，导出对应月统计分类快照并继续应用普通筛选。最多 10000 条，超限返回 400，需缩小范围。响应 X-Export-Coverage 声明 complete/partial，X-Export-Count 为导出条数；partial 不代表完整交易历史。统计 CSV 使用 USD展示金额/展示币种列，普通 CSV 仍使用实际结算金额/结算币种列，二者不可混用。 可选 source=local 用于接收通知后的页面刷新，只读本地记录，保留筛选和分页，不调用卡商。",
        "parameters": [
          {
            "name": "cardId",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "last4",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}$"
            }
          },
          {
            "name": "merchant",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          },
          {
            "name": "transactionId",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "$ref": "#/components/parameters/StatisticsMonth"
          },
          {
            "$ref": "#/components/parameters/StatisticsMetric"
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "local"
              ]
            },
            "description": "local 仅读取本地已同步或收到通知的记录，不发起卡商查询；不代表完整历史。与 statsMonth/metric 组合时仍按本地月份/分类过滤，coverage 为 partial。"
          }
        ],
        "responses": {
          "200": {
            "description": "CSV 下载。统计范围的 USD 展示金额不代表实际结算金额；未知金额保持空值。",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "headers": {
              "X-Export-Coverage": {
                "description": "本次导出数据的覆盖范围；partial 不等于完整月数据。",
                "schema": {
                  "type": "string",
                  "enum": [
                    "complete",
                    "partial"
                  ]
                }
              },
              "X-Export-Count": {
                "description": "CSV 中数据记录条数，不含表头。",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在，或不属于当前代理。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/topup-orders/{orderId}": {
      "get": {
        "summary": "按订单号查询账户充值申请",
        "operationId": "get_topup_orders_orderId",
        "tags": [
          "资金"
        ],
        "x-required-scope": "read",
        "description": "需要 read 权限；直接按订单号读取本租户历史充值申请，不受列表分页限制。返回 data.order，跨租户或不存在均返回 404；查询不会创建充值或增加余额。",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "order": {
                          "$ref": "#/components/schemas/TopupOrder"
                        }
                      },
                      "required": [
                        "order"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在，或不属于当前代理。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/OrderId"
          }
        ]
      }
    },
    "/issuance-capabilities": {
      "get": {
        "summary": "查询持卡人与批量开卡是否开放",
        "operationId": "get_issuance_capabilities",
        "tags": [
          "持卡人与批量开卡"
        ],
        "x-required-scope": "read",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/IssuanceCapabilities"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键与原业务参数冲突，或新单 confirmedQuote 与当前报价不同（quote_changed）；报价变化不会创建订单或冻结金额，应重新报价并让客户确认。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "可用余额不足等业务校验失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务或正式发卡暂不可用；开卡请求应使用原幂等键查询或重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/cardholders": {
      "get": {
        "summary": "查询自己登记的持卡人",
        "operationId": "get_cardholders",
        "tags": [
          "持卡人与批量开卡"
        ],
        "x-required-scope": "read",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Cardholder"
                          }
                        },
                        "enabled": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "items",
                        "enabled"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键与原业务参数冲突，或新单 confirmedQuote 与当前报价不同（quote_changed）；报价变化不会创建订单或冻结金额，应重新报价并让客户确认。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "可用余额不足等业务校验失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务或正式发卡暂不可用；开卡请求应使用原幂等键查询或重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "登记持卡人",
        "operationId": "post_cardholders",
        "tags": [
          "持卡人与批量开卡"
        ],
        "x-required-scope": "cardholders:write",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "holder": {
                          "$ref": "#/components/schemas/Cardholder"
                        },
                        "replay": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "holder"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "已创建本地记录；最终结果须查看业务状态。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "holder": {
                          "$ref": "#/components/schemas/Cardholder"
                        },
                        "replay": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "holder"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键与原业务参数冲突，或新单 confirmedQuote 与当前报价不同（quote_changed）；报价变化不会创建订单或冻结金额，应重新报价并让客户确认。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "可用余额不足等业务校验失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务或正式发卡暂不可用；开卡请求应使用原幂等键查询或重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CardholderInput"
              }
            }
          }
        },
        "description": "需要 cardholders:write 权限和平台功能已开放。必须保存幂等键和原请求；重试返回原记录，unknown 不重新创建，也不按姓名或邮箱认领外部记录。完整证件和地址仅用于本次发卡资料请求，不返回原始响应。"
      }
    },
    "/card-batches/quote": {
      "post": {
        "summary": "获取逐卡费用和整批报价",
        "operationId": "post_card_batches_quote",
        "tags": [
          "持卡人与批量开卡"
        ],
        "x-required-scope": "read",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/CardBatchQuote"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键与原业务参数冲突，或新单 confirmedQuote 与当前报价不同（quote_changed）；报价变化不会创建订单或冻结金额，应重新报价并让客户确认。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "可用余额不足等业务校验失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务或正式发卡暂不可用；开卡请求应使用原幂等键查询或重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CardBatchQuoteInput"
              }
            }
          }
        }
      }
    },
    "/card-batches": {
      "get": {
        "summary": "查询自己的批次",
        "operationId": "get_card_batches",
        "tags": [
          "持卡人与批量开卡"
        ],
        "x-required-scope": "read",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CardBatch"
                          }
                        }
                      },
                      "required": [
                        "items"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键与原业务参数冲突，或新单 confirmedQuote 与当前报价不同（quote_changed）；报价变化不会创建订单或冻结金额，应重新报价并让客户确认。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "可用余额不足等业务校验失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务或正式发卡暂不可用；开卡请求应使用原幂等键查询或重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "创建批量开卡申请",
        "operationId": "post_card_batches",
        "tags": [
          "持卡人与批量开卡"
        ],
        "x-required-scope": "cards:issue",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "batch": {
                          "$ref": "#/components/schemas/CardBatch"
                        },
                        "orders": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CardOrder"
                          }
                        },
                        "replay": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "batch",
                        "orders"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "已创建本地记录；最终结果须查看业务状态。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "batch": {
                          "$ref": "#/components/schemas/CardBatch"
                        },
                        "orders": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CardOrder"
                          }
                        },
                        "replay": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "batch",
                        "orders"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键与原业务参数冲突，或新单 confirmedQuote 与当前报价不同（quote_changed）；报价变化不会创建订单或冻结金额，应重新报价并让客户确认。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "可用余额不足等业务校验失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务或正式发卡暂不可用；开卡请求应使用原幂等键查询或重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CardBatchInput"
              }
            }
          }
        },
        "description": "本批次包含1–20张独立储值卡订单。一次事务保存全部订单并冻结合计，随后逐卡处理，每张分别等待交付和首充结果后结算。余额不足或新单报价变化时全批不创建。同键原请求重放不重复创建、冻结或提交。HTTP成功不等于全部开卡成功。 创建仅确认整批订单及冻结金额已持久化，后台串行处理各子单后返回最终结果；201不表示所有卡已开出。用GET原批次查询进度，结果未知时保留原单。"
      }
    },
    "/card-batches/{batchId}": {
      "get": {
        "summary": "查询批次及各张卡的订单",
        "operationId": "get_card_batch",
        "tags": [
          "持卡人与批量开卡"
        ],
        "x-required-scope": "read",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "batch": {
                          "$ref": "#/components/schemas/CardBatch"
                        },
                        "orders": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CardOrder"
                          }
                        }
                      },
                      "required": [
                        "batch",
                        "orders"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键与原业务参数冲突，或新单 confirmedQuote 与当前报价不同（quote_changed）；报价变化不会创建订单或冻结金额，应重新报价并让客户确认。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "可用余额不足等业务校验失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务或正式发卡暂不可用；开卡请求应使用原幂等键查询或重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/card-batches/{batchId}/reconcile": {
      "post": {
        "summary": "继续处理并核对原批次",
        "operationId": "post_card_batch_reconcile",
        "tags": [
          "持卡人与批量开卡"
        ],
        "x-required-scope": "cards:issue",
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "batch": {
                          "$ref": "#/components/schemas/CardBatch"
                        },
                        "orders": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CardOrder"
                          }
                        }
                      },
                      "required": [
                        "batch",
                        "orders"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键与原业务参数冲突，或新单 confirmedQuote 与当前报价不同（quote_changed）；报价变化不会创建订单或冻结金额，应重新报价并让客户确认。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "可用余额不足等业务校验失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务或正式发卡暂不可用；开卡请求应使用原幂等键查询或重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "description": "恢复原批次中尚未提交的子订单，查询已提交子订单的原请求。不重新生成批次或重开已提交卡片。未知结果继续保留冻结，部分成功按各子单分别结算。 此请求只把原批次加入受控后台队列，HTTP200不代表核对完成；之后GET原批次读取进度。已停用账户暂停后台处理，最终签名回调仍可收口原单。"
      }
    },
    "/dashboard-statistics": {
      "get": {
        "summary": "查询自己的月度交易统计",
        "operationId": "get_dashboard_statistics",
        "tags": [
          "卡片"
        ],
        "x-required-scope": "read",
        "description": "仅查询密钥所属代理账户的上海自然月统计，不需要写权限，也不触发开卡、卡资金操作或钱包写入；统计不是资金到账或结算证明。按账户、月份和当前卡片归属隔离短时快照。查询受分页和耗时限制，未完整取得时返回 partial，查询不可用时返回 unavailable；不要将 null 显示为 0，不以普通本地历史替代完整月查询。八项指标与 definitions 一同返回，退款比例可超过 100%。",
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "required": false,
            "description": "YYYY-MM，省略时使用 Asia/Shanghai 当前月；只允许当前月或过去月份，不接受未来月、空值及重复参数。",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(?:0[1-9]|1[0-2])$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/DashboardStatistics"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/notification-status": {
      "get": {
        "summary": "查询本账户交易及验证码通知变更标记",
        "operationId": "get_notification_status",
        "tags": [
          "卡片"
        ],
        "x-required-scope": "read",
        "description": "可在页面可见时每5秒读取revision；变化后使用source=local刷新交易。离开页面停止轮询。此接口从不返回验证码。",
        "responses": {
          "200": {
            "description": "成功；检查业务 status。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/NotificationStatus"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/cards/{cardId}/3ds-code": {
      "get": {
        "summary": "按需读取本账户卡片最新3DS验证码",
        "operationId": "get_card_3ds_code",
        "tags": [
          "卡片"
        ],
        "x-required-scope": "cards:reveal",
        "description": "额外要求 cards:reveal，普通只读密钥不可用；仅限本账户卡片。响应Cache-Control:no-store,private；验证码不进入日志、持久缓存或通用回调。source transactionTime起5分钟为平台可查看窗口，重试不延长。empty表示未收到，expired表示平台停止展示，实际有效期以支付页面为准。每账户每分钟120次；客户端须在离开详情、隐藏、退出或到期时清空明文。",
        "parameters": [
          {
            "name": "cardId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功；检查业务 status。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Card3dsCode"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "请求格式或参数不合法；检查 code。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API 密钥缺失、无效、已撤销，或账户已停用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "密钥没有此接口需要的 scope。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁，按 Retry-After 等待后重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "卡片不存在或不属于当前账户。"
          },
          "409": {
            "description": "当前卡片不允许查看资料。"
          },
          "503": {
            "description": "资料查看或通知服务未启用。"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "parameters": {
      "Limit": {
        "name": "limit",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 20
        }
      },
      "Cursor": {
        "name": "cursor",
        "in": "query",
        "description": "上一页返回的 nextCursor 原样传回，不要自行生成；null 表示末页。",
        "schema": {
          "type": "string"
        }
      },
      "CardId": {
        "name": "cardId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "OrderId": {
        "name": "orderId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "同一笔业务始终使用同一个唯一值；内容相同重试返回原订单，内容不同返回 409。新值表示新的独立交易。",
        "schema": {
          "type": "string",
          "minLength": 8,
          "maxLength": 128,
          "pattern": "^[A-Za-z0-9._:-]{8,128}$"
        }
      },
      "StatisticsMonth": {
        "name": "statsMonth",
        "in": "query",
        "required": false,
        "description": "统计明细的上海自然月 YYYY-MM，不接受未来月。必须与 metric 成对出现；缺少任一项、重复参数或无效值返回 400 invalid_input。省略两者时保持普通已同步交易查询。",
        "schema": {
          "type": "string",
          "pattern": "^\\d{4}-(?:0[1-9]|1[0-2])$"
        }
      },
      "StatisticsMetric": {
        "name": "metric",
        "in": "query",
        "required": false,
        "description": "必须与 statsMonth 成对出现。failed=失败消费；failed_nonzero=同时排除原始金额为 0 的失败消费；refunds=成功商户退款；purchases=已结算成功消费；pending_purchases=已授权未清算有效消费；total_purchases=成功消费总额对应的有效授权与已清算消费并集。与月统计使用相同分类器，再应用普通查询筛选。",
        "schema": {
          "type": "string",
          "enum": [
            "failed",
            "failed_nonzero",
            "refunds",
            "purchases",
            "pending_purchases",
            "total_purchases"
          ]
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "success": {
            "const": false
          },
          "code": {
            "type": "string"
          }
        },
        "required": [
          "success",
          "code"
        ]
      },
      "Wallet": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "tenantId": {
            "type": "string"
          },
          "currency": {
            "const": "USD"
          },
          "balance": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "15.00"
            ]
          },
          "availableBalance": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "15.00"
            ]
          },
          "frozenBalance": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "15.00"
            ]
          },
          "version": {
            "type": "integer"
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "currency",
          "balance",
          "availableBalance",
          "frozenBalance"
        ]
      },
      "Card": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "minimum": 1
          },
          "last4": {
            "type": "string",
            "pattern": "^\\d{4}$"
          },
          "expiry": {
            "type": [
              "string",
              "null"
            ],
            "description": "卡片实际有效期，格式 YYYY-MM。未取得时为 null；卡主成功读取普通储值卡完整资料后同步已核验有效期。完整资料按需读取返回 MM/YY，不可将缺失解释为无限期有效。"
          },
          "cardType": {
            "type": [
              "string",
              "null"
            ],
            "description": "原申请产品的卡类型 ID，保留订单和产品绑定；兼容历史 ID。它可能与实际交付卡的 BIN 不同，不能作为实卡前缀校验依据。新开卡仍使用当前目录返回的 id。"
          },
          "issuedCardBin": {
            "type": "string",
            "pattern": "^\\d{6,10}$",
            "readOnly": true,
            "description": "已核验的实际交付卡 BIN，仅用于已发卡展示；未知时不返回此字段。显示卡 BIN 时优先使用该值，cardType 仍是原申请产品 ID。不要把实际 BIN 拼成新产品或用于新开卡；新订单的 cardType 必须取自当前卡类型目录。"
          },
          "usageMode": {
            "enum": [
              "single",
              "multi",
              "prepaid"
            ]
          },
          "status": {
            "type": "string"
          },
          "subscriptionLimit": {
            "type": [
              "integer",
              "null"
            ],
            "description": "普通储值卡为 null，不适用授权次数上限。"
          },
          "usageCount": {
            "type": [
              "integer",
              "null"
            ]
          },
          "successfulPaymentCount": {
            "type": "integer"
          },
          "remaining": {
            "type": [
              "integer",
              "null"
            ],
            "description": "普通储值卡为 null；其他卡类在历史不完整时也可能为 null。"
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "balance": {
            "type": [
              "string",
              "null"
            ],
            "description": "独立余额查询返回的卡内余额；未同步时为 null，不能由开卡本金或钱包余额推算。"
          },
          "providerBalanceUpdatedAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "余额最近核对时间，ISO 8601 UTC。"
          },
          "capabilities": {
            "type": "object",
            "properties": {
              "usageLimit": {
                "type": "boolean"
              },
              "customExpiry": {
                "type": "boolean"
              },
              "localStatusControl": {
                "type": "boolean"
              }
            }
          },
          "version": {
            "type": "integer",
            "minimum": 0,
            "description": "卡片最新版本，卡操作必须原样携带。"
          },
          "operationCapabilities": {
            "$ref": "#/components/schemas/CardOperationCapabilities"
          },
          "balanceCurrency": {
            "type": [
              "string",
              "null"
            ],
            "description": "已核对的卡内余额币种；未知时为 null。"
          }
        },
        "required": [
          "id",
          "last4",
          "status"
        ]
      },
      "CardOrder": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "currency": {
            "const": "USD"
          },
          "cardType": {
            "type": "string",
            "description": "9aipay 卡类型 ID，使用卡类型目录返回的 id。普通储值卡通常使用数字 BIN 字符串，例如 537814；以目录返回的 id 为准，请勿自行拼接。"
          },
          "usageMode": {
            "enum": [
              "single",
              "multi",
              "prepaid"
            ]
          },
          "principal": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "15.00"
            ]
          },
          "cardOpenFee": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "15.00"
            ]
          },
          "rechargeServiceFee": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "15.00"
            ]
          },
          "customerTotal": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "15.00"
            ]
          },
          "status": {
            "enum": [
              "succeeded",
              "pending_provider",
              "processing",
              "failed",
              "unknown_frozen"
            ]
          },
          "cardId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "liveIssuance": {
            "type": "boolean"
          },
          "expiry": {
            "type": [
              "string",
              "null"
            ]
          },
          "rulesVersion": {
            "type": [
              "integer",
              "null"
            ]
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "failureCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "issuanceStage": {
            "type": [
              "string",
              "null"
            ],
            "description": "发卡流程阶段。FUNDING_PENDING 表示卡已交付但首次转入尚未确认，金额保持冻结；DELIVERABLE 才表示交付与首充都已核实。不要仅凭卡 ID 判断完成。"
          },
          "canReconcile": {
            "type": "boolean",
            "description": "当前是否允许通过原订单 reconcile 接口核对；不要根据状态自行猜测。"
          }
        },
        "required": [
          "id",
          "status",
          "principal",
          "customerTotal"
        ]
      },
      "TopupOrder": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "currency": {
            "const": "USD"
          },
          "amount": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "15.00"
            ]
          },
          "rechargeServiceFee": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "15.00"
            ]
          },
          "totalCharged": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "15.00"
            ]
          },
          "status": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "manual",
              "usdt_trc20",
              "usdt_okx_trc20",
              "usdt_okx_internal"
            ]
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "paidAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "usdt": {
            "$ref": "#/components/schemas/UsdtInvoice"
          },
          "okxInternal": {
            "$ref": "#/components/schemas/OkxInternalInvoice",
            "description": "仅 usdt_okx_internal 订单返回。固定接收 UID 与完整实付金额均取自本订单；没有链上地址或 TXID。"
          },
          "payment": {
            "type": "object",
            "description": "展示付款核查进度，不代替 order.status。内部订单使用 unpaid/checking/review_required/expired/credited；只有 order.status=paid 表示已入账。",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "awaiting_payment",
                  "detected",
                  "ambiguous",
                  "mismatch",
                  "late",
                  "used",
                  "paid",
                  "rejected",
                  "expired",
                  "unpaid",
                  "checking",
                  "review_required",
                  "credited"
                ]
              },
              "txId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "amount": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "occurredAt": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "checkedAt": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "automaticCredit": {
                "type": "boolean"
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              },
              "lastCheckedAt": {
                "type": "string",
                "format": "date-time"
              },
              "errorCode": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "creditMethod": {
            "type": "string",
            "enum": [
              "manual",
              "okx_auto",
              "okx_internal_auto"
            ],
            "description": "实际入账方式；仅订单paid后确认。旧记录可不提供。"
          }
        },
        "required": [
          "id",
          "amount",
          "status",
          "provider"
        ]
      },
      "LedgerEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "amount": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "15.00"
            ],
            "description": "使用本地账本 amountCents 生成的 USD 金额；可靠值缺失时为 null，不推定为零。"
          },
          "balanceAfter": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "15.00"
            ],
            "description": "本地账本保存的历史余额；可靠值缺失时为 null，不使用当前钱包余额或零补齐。"
          },
          "availableAfter": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "15.00"
            ],
            "description": "本地账本保存的历史余额；可靠值缺失时为 null，不使用当前钱包余额或零补齐。"
          },
          "referenceType": {
            "type": [
              "string",
              "null"
            ]
          },
          "referenceId": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "direction": {
            "type": "string",
            "enum": [
              "credit",
              "debit",
              "neutral"
            ],
            "description": "根据本地账本金额的正负和零确定；零金额冻结及释放为 neutral。"
          }
        },
        "required": [
          "id",
          "amount",
          "type"
        ]
      },
      "Transaction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "cardId": {
            "type": "integer"
          },
          "type": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "merchant": {
            "type": [
              "string",
              "null"
            ]
          },
          "amount": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?\\d{1,24}(?:\\.\\d{1,8})?$",
            "description": "交易原币金额；最多八位小数。缺失或未核实时为 null，不能按零处理。"
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[A-Z]{3}$"
          },
          "referenceId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "settledAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "failureCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "settlementAmount": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?\\d{1,24}(?:\\.\\d{1,8})?$",
            "description": "实际取得的结算金额；缺失时为 null，不由交易金额或币种推算。"
          },
          "settlementCurrency": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[A-Z]{3}$"
          },
          "usdDisplayAmount": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?(?:0|[1-9]\\d*)\\.\\d{2}$",
            "readOnly": true,
            "description": "统计范围可选字段：卡商查询页 USD 展示金额，不是实际结算金额或钱包入账证明。保留正负号、恰好两位小数；缺失或未核实时为 null，不能使用原币或 settlementAmount 推算。"
          },
          "actualAmount": {
            "type": [
              "string",
              "null"
            ],
            "description": "卡商本交易阶段确认的实际金额快照，已含 feeAmount；不得再次加减手续费，不等于授权原币或结算本金。"
          },
          "actualCurrency": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[A-Z]{3}$"
          },
          "feeAmount": {
            "type": [
              "string",
              "null"
            ],
            "description": "已计入 actualAmount 的手续费，币种与 actualCurrency 一致；不额外累计。"
          },
          "relatedTransactionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "退款、撤销、修正关联的原交易标识；关联记录不得与原消费机械累加。"
          }
        },
        "required": [
          "cardId",
          "amount",
          "currency",
          "status"
        ]
      },
      "QuoteInput": {
        "type": "object",
        "properties": {
          "cardType": {
            "type": "string",
            "description": "9aipay 卡类型 ID，使用卡类型目录返回的 id。普通储值卡通常使用数字 BIN 字符串，例如 537814；以目录返回的 id 为准，请勿自行拼接。"
          },
          "usageMode": {
            "enum": [
              "prepaid"
            ],
            "description": "新申请仅支持普通储值卡。"
          },
          "principal": {
            "type": "string",
            "pattern": "^(?:[5-9]|[1-9]\\d+)(?:\\.\\d{1,2})?$",
            "description": "USD 十进制金额字符串，最多两位小数；首次转入至少 5.00 USD，并须达到目录中该产品的 minPrincipal。以实时目录和服务器校验为准。",
            "examples": [
              "5.00"
            ]
          }
        },
        "required": [
          "cardType",
          "usageMode",
          "principal"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "cardType": "537814",
            "usageMode": "prepaid",
            "principal": "5.00"
          }
        ]
      },
      "CardOrderInput": {
        "type": "object",
        "properties": {
          "cardType": {
            "type": "string",
            "description": "9aipay 卡类型 ID，使用卡类型目录返回的 id。普通储值卡通常使用数字 BIN 字符串，例如 537814；以目录返回的 id 为准，请勿自行拼接。"
          },
          "usageMode": {
            "enum": [
              "prepaid"
            ],
            "description": "新申请仅支持普通储值卡。"
          },
          "principal": {
            "type": "string",
            "pattern": "^(?:[5-9]|[1-9]\\d+)(?:\\.\\d{1,2})?$",
            "description": "USD 十进制金额字符串，最多两位小数；首次转入至少 5.00 USD，并须达到目录中该产品的 minPrincipal。以实时目录和服务器校验为准。",
            "examples": [
              "5.00"
            ]
          },
          "note": {
            "type": "string",
            "maxLength": 40,
            "description": "新申请最多 40 字符，会同步到卡片备注。"
          },
          "confirmedQuote": {
            "$ref": "#/components/schemas/ConfirmedQuoteInput"
          },
          "holderId": {
            "type": "string",
            "description": "本账户持卡人列表返回的 9aipay ID。仅普通储值卡可选，省略使用默认资料。不能填写其他账户或外部系统的持卡人编号。"
          }
        },
        "required": [
          "cardType",
          "usageMode",
          "principal"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "cardType": "537814",
            "usageMode": "prepaid",
            "principal": "5.00"
          }
        ],
        "description": "本结构用于新申请：仅支持 prepaid 普通储值卡，不接受授权次数或自选截止月。历史订单仍可使用原幂等键和完全相同的原业务参数重放，仅返回原订单，不创建新申请。"
      },
      "ConfirmedQuoteInput": {
        "type": "object",
        "description": "创建单卡或批次时可选的报价确认。使用对应报价接口同一次响应的规则版本和总金额；批次使用全批合计。新请求发生价格变化则拒绝，已有相同业务请求仍按原幂等键返回。",
        "additionalProperties": false,
        "required": [
          "rulesVersion",
          "customerTotal"
        ],
        "properties": {
          "rulesVersion": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "报价响应中的已发布规则版本，正安全整数。"
          },
          "customerTotal": {
            "type": "string",
            "pattern": "^(?:0|[1-9]\\d*)(?:\\.\\d{1,2})?$",
            "description": "报价响应中的应付合计，USD 十进制字符串，最多两位小数；转换为美分后须介于 1 和 9007199254740991。建议原样复制报价的两位小数字符串，不自行计算或四舍五入。",
            "examples": [
              "5.40"
            ]
          }
        }
      },
      "TopupInput": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "string",
            "pattern": "^(?:0|[1-9]\\d*)(?:\\.\\d{1,2})?$",
            "description": "USD 十进制金额字符串，必须大于 0；最多两位小数。不要用浮点数或分为单位。",
            "examples": [
              "15.00"
            ]
          },
          "currency": {
            "const": "USD",
            "default": "USD"
          },
          "mode": {
            "type": "string",
            "enum": [
              "manual",
              "usdt_trc20",
              "usdt_okx_trc20",
              "usdt_okx_internal"
            ],
            "default": "manual",
            "description": "Read /topup-methods first and explicitly pass an available ID. Prefer usdt_okx_internal for new OKX-user USDT payments when returned. Omission remains manual for compatibility. Recipient UID, payment amount, FX and expiry come only from the resulting order."
          }
        },
        "required": [
          "amount"
        ],
        "additionalProperties": false
      },
      "CardCredentials": {
        "type": "object",
        "properties": {
          "cardId": {
            "type": "integer"
          },
          "cardNumber": {
            "type": "string"
          },
          "expiry": {
            "type": "string",
            "pattern": "^(?:0[1-9]|1[0-2])/\\d{2}$"
          },
          "securityCode": {
            "type": "string",
            "pattern": "^\\d{3,4}$"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "cardId",
          "cardNumber",
          "expiry",
          "securityCode",
          "expiresAt"
        ]
      },
      "Quote": {
        "type": "object",
        "properties": {
          "rulesVersion": {
            "type": "integer"
          },
          "currency": {
            "const": "USD"
          },
          "principal": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "15.00"
            ]
          },
          "cardOpenFee": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "15.00"
            ]
          },
          "customerTotal": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "15.00"
            ]
          }
        }
      },
      "OkxInternalInvoice": {
        "type": "object",
        "additionalProperties": false,
        "description": "欧易用户之间的 USDT 内部付款指示；只使用此订单返回的固定 recipientUid 和完整 payableAmount。金额含匹配尾数，必须精确支付，不去尾、不四舍五入。不生成链上地址二维码，不要求 TXID，也不提交客户声称的充值 ID。接收账号凭据、付款人信息及供应商回执均不公开。",
        "properties": {
          "asset": {
            "const": "USDT"
          },
          "decimals": {
            "const": 6
          },
          "recipientUid": {
            "type": "string",
            "pattern": "^\\d{1,40}$",
            "description": "服务端锁定的业务接收 UID，仅用于展示/复制到欧易用户转账表单；不要放入 URL，不允许调用方指定或替换。"
          },
          "payableUnits": {
            "type": "string",
            "pattern": "^[1-9][0-9]*$",
            "description": "完整应付 USDT 的6位最小单位整数字符串，已经包含匹配尾数。"
          },
          "payableAmount": {
            "type": "string",
            "pattern": "^[0-9]+\\.[0-9]{6}$",
            "description": "用户应在欧易支付的完整 USDT 数量，必须原样展示和支付。"
          },
          "usdPerUsdt": {
            "type": "string",
            "pattern": "^[0-9]+\\.[0-9]{8}$"
          },
          "fxSource": {
            "type": "string"
          },
          "fxObservedAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "basePayableUnits": {
            "type": "string",
            "pattern": "^[1-9][0-9]*$"
          },
          "matchingAdjustmentUnits": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "matchingAdjustmentAmount": {
            "type": "string",
            "pattern": "^[0-9]+\\.[0-9]{6}$",
            "description": "完整金额已包含的匹配尾数，0至0.009999 USDT；不能从 payableAmount 中扣除。"
          },
          "automaticCredit": {
            "const": true
          }
        },
        "required": [
          "asset",
          "decimals",
          "recipientUid",
          "payableUnits",
          "payableAmount",
          "usdPerUsdt",
          "fxSource",
          "fxObservedAt",
          "expiresAt",
          "basePayableUnits",
          "matchingAdjustmentUnits",
          "matchingAdjustmentAmount",
          "automaticCredit"
        ]
      },
      "UsdtInvoice": {
        "type": "object",
        "properties": {
          "network": {
            "type": "string"
          },
          "asset": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "contract": {
            "type": "string"
          },
          "payableUnits": {
            "type": "string"
          },
          "payableAmount": {
            "type": "string"
          },
          "usdPerUsdt": {
            "type": "string"
          },
          "fxSource": {
            "type": "string"
          },
          "fxObservedAt": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string"
          },
          "decimals": {
            "const": 6
          },
          "automaticCredit": {
            "type": "boolean",
            "description": "本订单创建时已启用欧易自动核验；旧人工单不受后续开关影响。"
          },
          "basePayableUnits": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "锁定的USDT最小单位金额，仅分配尾数的新订单提供。"
          },
          "matchingAdjustmentUnits": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "锁定的USDT最小单位金额，仅分配尾数的新订单提供。"
          },
          "matchingAdjustmentAmount": {
            "type": "string",
            "pattern": "^[0-9]+\\.[0-9]{6}$",
            "description": "完整应付金额已包含的匹配尾数，0至0.009999 USDT。"
          }
        },
        "required": [
          "network",
          "asset",
          "address",
          "payableAmount",
          "usdPerUsdt",
          "fxObservedAt",
          "expiresAt"
        ]
      },
      "CardBalanceSummary": {
        "type": "object",
        "properties": {
          "status": {
            "enum": [
              "available",
              "partial",
              "unavailable",
              "empty"
            ]
          },
          "totalCards": {
            "type": "integer"
          },
          "coveredCards": {
            "type": "integer"
          },
          "unavailableCards": {
            "type": "integer"
          },
          "amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "currencies": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "currency": {
                  "type": "string"
                },
                "amount": {
                  "type": "string"
                }
              }
            }
          },
          "source": {
            "type": "string"
          },
          "live": {
            "type": "boolean"
          },
          "checkedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "status",
          "totalCards",
          "coveredCards",
          "unavailableCards",
          "currencies"
        ],
        "description": "只合计已取得且属于当前账户的余额。partial 表示部分卡片缺少余额；不将未提供余额当作 0。"
      },
      "CardTransactionPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Transaction"
            }
          },
          "total": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextOffset": {
            "type": [
              "integer",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "coverage": {
            "type": "string",
            "description": "complete 表示该统计快照已完整核验；partial 表示只取得部分记录，普通本地同步历史也属于 partial。不能将 partial 页的 total 当作全月总量。"
          },
          "live": {
            "type": "boolean"
          },
          "dateTimezone": {
            "type": "string"
          },
          "statsMonth": {
            "type": "string",
            "pattern": "^\\d{4}-(?:0[1-9]|1[0-2])$",
            "description": "仅统计范围返回，对应 statsMonth 查询值。"
          },
          "metric": {
            "type": "string",
            "enum": [
              "failed",
              "failed_nonzero",
              "refunds",
              "purchases",
              "pending_purchases",
              "total_purchases"
            ],
            "description": "仅统计范围返回，对应同月统计分类。"
          },
          "checkedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "仅统计范围返回的快照检查时间。"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "仅统计范围返回的不完整原因。"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "hasMore",
          "nextOffset"
        ]
      },
      "CardOperation": {
        "type": "object",
        "required": [
          "id",
          "cardId",
          "type",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "cardId": {
            "type": "integer",
            "minimum": 1
          },
          "type": {
            "type": "string",
            "enum": [
              "recharge",
              "freeze",
              "unfreeze"
            ]
          },
          "amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "fee": {
            "type": "string",
            "description": "卡片追加转入服务费为 0；账户充值费用不重复收取。"
          },
          "total": {
            "type": "string"
          },
          "currency": {
            "const": "USD"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "unknown",
              "unknown_frozen",
              "succeeded",
              "failed"
            ]
          },
          "errorCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "version": {
            "type": "integer",
            "minimum": 0
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "replay": {
            "type": "boolean"
          }
        }
      },
      "CardOperationInput": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "amount",
              "version"
            ],
            "properties": {
              "type": {
                "const": "recharge"
              },
              "amount": {
                "type": "string",
                "pattern": "^(?!0\\.00$)(?:(?:0|[1-9]\\d{0,5})\\.\\d{2}|1000000\\.00)$",
                "description": "恰好两位小数的USD字符串；新充值不得低于卡详情operationCapabilities.minRechargeAmount（当前1.00）。低于当前最低额的历史操作仅可原键、原内容重放。技术金额上限1000000.00。",
                "example": "10.00"
              },
              "version": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "version"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "freeze",
                  "unfreeze"
                ]
              },
              "version": {
                "type": "integer",
                "minimum": 0
              }
            }
          }
        ]
      },
      "IssuanceCapabilities": {
        "type": "object",
        "properties": {
          "cardholdersEnabled": {
            "type": "boolean"
          },
          "batchEnabled": {
            "type": "boolean"
          },
          "maxBatchCount": {
            "type": "integer",
            "maximum": 20,
            "description": "当前新批次上限5张；始终先读取此字段。内部历史容量20不代表当前可新建20张。"
          }
        },
        "required": [
          "cardholdersEnabled",
          "batchEnabled",
          "maxBatchCount"
        ]
      },
      "Cardholder": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "idType": {
            "type": "string"
          },
          "idLast4": {
            "type": "string",
            "description": "脱敏证件尾号。"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "active",
              "inactive",
              "unknown",
              "failed"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "status"
        ]
      },
      "CardholderInput": {
        "type": "object",
        "properties": {
          "firstName": {
            "type": "string",
            "pattern": "^[A-Za-z]{1,20}$"
          },
          "lastName": {
            "type": "string",
            "pattern": "^[A-Za-z]{1,20}$"
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254
          },
          "idType": {
            "type": "string",
            "enum": [
              "PASSPORT",
              "NATIONAL_ID",
              "DRIVER_LICENSE"
            ]
          },
          "idNumber": {
            "type": "string",
            "pattern": "^[A-Za-z0-9-]{3,50}$",
            "writeOnly": true
          },
          "state": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "writeOnly": true
          },
          "city": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "writeOnly": true
          },
          "address": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "writeOnly": true
          },
          "postCode": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32,
            "writeOnly": true
          },
          "country": {
            "type": "string",
            "pattern": "^[A-Z]{2}$"
          },
          "mobile": {
            "type": "string",
            "description": "可选，+开头的完整国际号码。",
            "writeOnly": true
          },
          "remark": {
            "type": "string",
            "maxLength": 500,
            "writeOnly": true
          }
        },
        "required": [
          "firstName",
          "lastName",
          "email",
          "idType",
          "idNumber",
          "state",
          "city",
          "address",
          "postCode",
          "country"
        ],
        "additionalProperties": false,
        "description": "提交前向持卡人说明信息用于发卡核验并交由发卡服务商处理；完整证件和详细地址不会在本站列表或普通日志中返回。未知创建结果不使用新幂等键重建。"
      },
      "CardBatchQuoteInput": {
        "type": "object",
        "properties": {
          "cardType": {
            "type": "string",
            "description": "9aipay 卡类型 ID，使用卡类型目录返回的 id。普通储值卡通常使用数字 BIN 字符串，例如 537814；以目录返回的 id 为准，请勿自行拼接。"
          },
          "usageMode": {
            "const": "prepaid",
            "description": "新申请仅支持普通储值卡。"
          },
          "principal": {
            "type": "string",
            "pattern": "^(?:[5-9]|[1-9]\\d+)(?:\\.\\d{1,2})?$",
            "description": "USD 十进制金额字符串，最多两位小数；首次转入至少 5.00 USD，并须达到目录中该产品的 minPrincipal。以实时目录和服务器校验为准。",
            "examples": [
              "5.00"
            ]
          },
          "cardCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "description": "当前新批次数量1–5，且不得超过issuance-capabilities.maxBatchCount。"
          }
        },
        "required": [
          "cardType",
          "usageMode",
          "principal",
          "cardCount"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "cardType": "537814",
            "usageMode": "prepaid",
            "principal": "5.00",
            "cardCount": 3
          }
        ]
      },
      "CardBatchInput": {
        "type": "object",
        "properties": {
          "cardType": {
            "type": "string",
            "description": "9aipay 卡类型 ID，使用卡类型目录返回的 id。普通储值卡通常使用数字 BIN 字符串，例如 537814；以目录返回的 id 为准，请勿自行拼接。"
          },
          "usageMode": {
            "const": "prepaid",
            "description": "新申请仅支持普通储值卡。"
          },
          "principal": {
            "type": "string",
            "pattern": "^(?:[5-9]|[1-9]\\d+)(?:\\.\\d{1,2})?$",
            "description": "USD 十进制金额字符串，最多两位小数；首次转入至少 5.00 USD，并须达到目录中该产品的 minPrincipal。以实时目录和服务器校验为准。",
            "examples": [
              "5.00"
            ]
          },
          "cardCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20,
            "description": "当前新建1–5张，且不得超过issuance-capabilities.maxBatchCount。上限20只保留已受理历史请求的原键原内容重放。"
          },
          "holderId": {
            "type": "string",
            "description": "本账户持卡人列表返回的 9aipay ID。仅普通储值卡可选，省略使用默认资料。不能填写其他账户或外部系统的持卡人编号。"
          },
          "note": {
            "type": "string",
            "maxLength": 40
          },
          "confirmedQuote": {
            "$ref": "#/components/schemas/ConfirmedQuoteInput"
          }
        },
        "required": [
          "cardType",
          "usageMode",
          "principal",
          "cardCount"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "cardType": "537814",
            "usageMode": "prepaid",
            "principal": "5.00",
            "cardCount": 3
          }
        ]
      },
      "CardBatchQuote": {
        "type": "object",
        "properties": {
          "cardType": {
            "type": "string"
          },
          "usageMode": {
            "const": "prepaid"
          },
          "principal": {
            "type": "string",
            "description": "每张卡的首次转入金额，USD。"
          },
          "cardCount": {
            "type": "integer"
          },
          "currency": {
            "const": "USD"
          },
          "rulesVersion": {
            "type": "integer"
          },
          "perCard": {
            "$ref": "#/components/schemas/Quote"
          },
          "customerTotal": {
            "type": "string",
            "description": "整批冻结合计，USD。"
          },
          "cardOpenFee": {
            "type": "string",
            "description": "整批开卡服务费合计，USD。"
          }
        }
      },
      "CardBatch": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "cardType": {
            "type": "string"
          },
          "cardCount": {
            "type": "integer"
          },
          "principal": {
            "type": "string",
            "description": "每张卡首次转入金额。"
          },
          "customerTotal": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "pending表示已受理并进入后台队列，processing表示原单处理中；逐卡结算，以各子订单最终结果为准。",
            "enum": [
              "pending",
              "processing",
              "succeeded",
              "failed",
              "partial_success",
              "unknown_frozen"
            ]
          },
          "counts": {
            "type": "object",
            "properties": {
              "pending": {
                "type": "integer",
                "minimum": 0
              },
              "succeeded": {
                "type": "integer",
                "minimum": 0
              },
              "failed": {
                "type": "integer",
                "minimum": 0
              },
              "unknown": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "pending",
              "succeeded",
              "failed",
              "unknown"
            ]
          },
          "holderId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          }
        },
        "required": [
          "id",
          "cardCount",
          "status",
          "counts"
        ]
      },
      "CardOperationCapabilities": {
        "type": "object",
        "description": "当前卡片是否允许对应操作；随卡状态、处理中操作和平台功能开放情况变化。密钥仍需 cards:operate。",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "recharge": {
            "type": "boolean"
          },
          "freeze": {
            "type": "boolean"
          },
          "unfreeze": {
            "type": "boolean"
          },
          "minRechargeAmount": {
            "type": "string",
            "pattern": "^(0|[1-9]\\d*)\\.\\d{2}$",
            "description": "新卡内充值的最低USD金额；当前为1.00，提交前以此字段及recharge能力为准。历史原幂等键请求保持原参数重放。",
            "example": "1.00"
          }
        },
        "required": [
          "enabled",
          "recharge",
          "freeze",
          "unfreeze",
          "minRechargeAmount"
        ]
      },
      "DashboardStatisticsPeriod": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "month",
          "startDate",
          "endDate",
          "timezone",
          "startAt",
          "endAtExclusive"
        ],
        "properties": {
          "month": {
            "type": "string",
            "pattern": "^\\d{4}-(?:0[1-9]|1[0-2])$"
          },
          "startDate": {
            "type": "string",
            "format": "date",
            "description": "上海自然月第一天。"
          },
          "endDate": {
            "type": "string",
            "format": "date",
            "description": "上海自然月最后一天，包含当日。"
          },
          "timezone": {
            "type": "string",
            "const": "Asia/Shanghai"
          },
          "startAt": {
            "type": "string",
            "format": "date-time",
            "description": "上海月初对应的 UTC 时刻，包含此时刻。"
          },
          "endAtExclusive": {
            "type": "string",
            "format": "date-time",
            "description": "下月上海月初对应的 UTC 时刻，不包含此时刻；当前月查询只读取截至本次查询时已发生的记录。"
          }
        }
      },
      "DashboardStatisticsCoverage": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "status",
          "checkedAt",
          "reason"
        ],
        "description": "完整性仅针对当前账户、本次月查询范围；不是实时资金证明。",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "complete",
              "partial",
              "unavailable"
            ],
            "description": "complete 表示该月查询已核验完整；partial 表示未完整取得或存在冲突；unavailable 表示查询服务不可用。"
          },
          "checkedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "本次快照检查时间；不可用时可为 null。"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "不完整或不可用的机器可读原因；complete 时为 null。"
          }
        }
      },
      "DashboardStatisticsMetrics": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "failedCount",
          "failureRate",
          "failureRateExcludingZero",
          "refundCount",
          "refundRate",
          "refundAmountUsd",
          "refundAmountRate",
          "purchaseAmountUsd",
          "pendingPurchaseAmountUsd",
          "totalPurchaseAmountUsd"
        ],
        "properties": {
          "failedCount": {
            "type": [
              "integer",
              "null"
            ],
            "description": "本月已结束消费请求中失败或拒绝的笔数；同一消费的授权、清算阶段只计一次。 未取得或不适用时为 null，不能按 0 处理。",
            "minimum": 0
          },
          "failureRate": {
            "type": [
              "number",
              "null"
            ],
            "description": "失败消费请求笔数 ÷ 全部已结束消费请求笔数 × 100；处理中不进入分母。 未取得或不适用时为 null，不能按 0 处理。",
            "minimum": 0,
            "maximum": 100
          },
          "failureRateExcludingZero": {
            "type": [
              "number",
              "null"
            ],
            "description": "按 failureRate 同一口径，同时从分子、分母剔除原始金额为 0 的请求。 未取得或不适用时为 null，不能按 0 处理。",
            "minimum": 0,
            "maximum": 100
          },
          "refundCount": {
            "type": [
              "integer",
              "null"
            ],
            "description": "本月成功商户消费退款记录笔数；排除授权撤销、卡余额转出及销卡退款。 未取得或不适用时为 null，不能按 0 处理。",
            "minimum": 0
          },
          "refundRate": {
            "type": [
              "number",
              "null"
            ],
            "description": "本月成功商户退款笔数 ÷ 本月成功消费请求笔数 × 100；可能含跨月原消费的退款，允许超过 100%。 未取得或不适用时为 null，不能按 0 处理。",
            "minimum": 0
          },
          "refundAmountUsd": {
            "type": [
              "string",
              "null"
            ],
            "description": "本月成功商户退款的卡商查询页 USD 展示金额绝对值合计；不按原币金额估算汇率，不代表实际结算金额。 未取得或不适用时为 null，不能按 0 处理。",
            "pattern": "^(?:0|[1-9]\\d*)\\.\\d{2}$"
          },
          "refundAmountRate": {
            "type": [
              "number",
              "null"
            ],
            "description": "本月商户退款 USD 展示金额 ÷ 本月已结算消费 USD 展示金额 × 100；允许超过 100%。 未取得或不适用时为 null，不能按 0 处理。",
            "minimum": 0
          },
          "purchaseAmountUsd": {
            "type": [
              "string",
              "null"
            ],
            "description": "本月已结算成功消费的卡商查询页 USD 展示金额绝对值合计；不重复累计授权或订单修正，不代表钱包扣款或实际结算金额。 未取得或不适用时为 null，不能按 0 处理。",
            "pattern": "^(?:0|[1-9]\\d*)\\.\\d{2}$"
          },
          "pendingPurchaseAmountUsd": {
            "type": [
              "string",
              "null"
            ],
            "description": "本月已授权未清算消费的卡商查询页 USD 展示金额绝对值合计；包含 AUTHORIZED、APPROVED、SUCCESS、SUCCEEDED 状态，排除已清算、0元验证、充值、失败、撤销和退款；同卡同交易阶段去重，清算后移出，不代表最终结算金额。 未取得或不适用时为 null，不能按 0 处理。",
            "pattern": "^(?:0|[1-9]\\d*)\\.\\d{2}$"
          },
          "totalPurchaseAmountUsd": {
            "type": [
              "string",
              "null"
            ],
            "description": "本月成功消费的卡商查询页 USD 展示金额绝对值合计；包含有效授权和已清算消费，同笔交易的授权、清算阶段只计一次；独立退款流水、充值和验证不计入，不代表钱包扣款或最终结算金额。 未取得或不适用时为 null，不能按 0 处理。",
            "pattern": "^(?:0|[1-9]\\d*)\\.\\d{2}$"
          }
        }
      },
      "DashboardStatisticsDefinitions": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "failedCount",
          "failureRate",
          "failureRateExcludingZero",
          "refundCount",
          "refundRate",
          "refundAmountUsd",
          "refundAmountRate",
          "purchaseAmountUsd",
          "pendingPurchaseAmountUsd",
          "totalPurchaseAmountUsd"
        ],
        "properties": {
          "failedCount": {
            "type": "string",
            "description": "本月已结束消费请求中失败或拒绝的笔数；同一消费的授权、清算阶段只计一次。"
          },
          "failureRate": {
            "type": "string",
            "description": "失败消费请求笔数 ÷ 全部已结束消费请求笔数 × 100；处理中不进入分母。"
          },
          "failureRateExcludingZero": {
            "type": "string",
            "description": "按 failureRate 同一口径，同时从分子、分母剔除原始金额为 0 的请求。"
          },
          "refundCount": {
            "type": "string",
            "description": "本月成功商户消费退款记录笔数；排除授权撤销、卡余额转出及销卡退款。"
          },
          "refundRate": {
            "type": "string",
            "description": "本月成功商户退款笔数 ÷ 本月成功消费请求笔数 × 100；可能含跨月原消费的退款，允许超过 100%。"
          },
          "refundAmountUsd": {
            "type": "string",
            "description": "本月成功商户退款的卡商查询页 USD 展示金额绝对值合计；不按原币金额估算汇率，不代表实际结算金额。"
          },
          "refundAmountRate": {
            "type": "string",
            "description": "本月商户退款 USD 展示金额 ÷ 本月已结算消费 USD 展示金额 × 100；允许超过 100%。"
          },
          "purchaseAmountUsd": {
            "type": "string",
            "description": "本月已结算成功消费的卡商查询页 USD 展示金额绝对值合计；不重复累计授权或订单修正，不代表钱包扣款或实际结算金额。"
          },
          "pendingPurchaseAmountUsd": {
            "type": "string",
            "description": "本月已授权未清算消费的卡商查询页 USD 展示金额绝对值合计；包含 AUTHORIZED、APPROVED、SUCCESS、SUCCEEDED 状态，排除已清算、0元验证、充值、失败、撤销和退款；同卡同交易阶段去重，清算后移出，不代表最终结算金额。"
          },
          "totalPurchaseAmountUsd": {
            "type": "string",
            "description": "本月成功消费的卡商查询页 USD 展示金额绝对值合计；包含有效授权和已清算消费，同笔交易的授权、清算阶段只计一次；独立退款流水、充值和验证不计入，不代表钱包扣款或最终结算金额。"
          }
        }
      },
      "DashboardStatistics": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "period",
          "coverage",
          "metrics",
          "definitions"
        ],
        "description": "当前代理账户的月统计，只读且不作资金证明。比例为百分数数值，例如 12.5 代表 12.5%；分母为 0 时比例返回 null。coverage 为 partial 或 unavailable 时十项 metrics 全部为 null，不得伪造 0 或使用普通本地流水补齐。complete 且无记录时计数、金额为 0，比例仍为 null；USD 字段缺失时相关金额/比例可为 null。退款比例允许超过 100%。",
        "properties": {
          "period": {
            "$ref": "#/components/schemas/DashboardStatisticsPeriod"
          },
          "coverage": {
            "$ref": "#/components/schemas/DashboardStatisticsCoverage"
          },
          "metrics": {
            "$ref": "#/components/schemas/DashboardStatisticsMetrics"
          },
          "definitions": {
            "$ref": "#/components/schemas/DashboardStatisticsDefinitions"
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "coverage": {
                  "properties": {
                    "status": {
                      "enum": [
                        "partial",
                        "unavailable"
                      ]
                    }
                  },
                  "required": [
                    "status"
                  ]
                }
              },
              "required": [
                "coverage"
              ]
            },
            "then": {
              "properties": {
                "metrics": {
                  "properties": {
                    "failedCount": {
                      "type": "null"
                    },
                    "failureRate": {
                      "type": "null"
                    },
                    "failureRateExcludingZero": {
                      "type": "null"
                    },
                    "refundCount": {
                      "type": "null"
                    },
                    "refundRate": {
                      "type": "null"
                    },
                    "refundAmountUsd": {
                      "type": "null"
                    },
                    "refundAmountRate": {
                      "type": "null"
                    },
                    "purchaseAmountUsd": {
                      "type": "null"
                    },
                    "pendingPurchaseAmountUsd": {
                      "type": "null"
                    },
                    "totalPurchaseAmountUsd": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "NotificationStatus": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "revision": {
            "type": "string",
            "description": "本账户通知变更标记，仅比较相等性；不包含验证码。"
          },
          "serverTime": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "enabled",
          "revision",
          "serverTime"
        ]
      },
      "Card3dsCode": {
        "type": "object",
        "description": "仅按需读取自己的3DS验证码。五分钟为平台展示窗口，实际有效期以支付页面为准。",
        "properties": {
          "cardId": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "available",
              "empty",
              "expired"
            ]
          },
          "serverTime": {
            "type": "string",
            "format": "date-time"
          },
          "code": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "otpCode": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 64,
                    "writeOnly": false
                  },
                  "merchant": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "amount": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "卡商3DS原始金额字符串，可含0至8位小数；缺失或不安全时为null，不影响验证码查看。不是本平台扣款或到账指令。"
                  },
                  "currency": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "receivedAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "卡商首次收到验证码的时间，重复推送不重置。"
                  },
                  "expiresAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "平台停止展示的时间，不代表卡商承诺的验证码有效期。"
                  }
                },
                "required": [
                  "otpCode",
                  "merchant",
                  "amount",
                  "currency",
                  "receivedAt",
                  "expiresAt"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "required": [
          "cardId",
          "status",
          "code",
          "serverTime"
        ],
        "additionalProperties": false
      }
    }
  },
  "webhooks": {
    "developerEvent": {
      "post": {
        "summary": "开发者状态更新事件",
        "description": "配置创建时以当前状态为基线，不补发历史。四事件：card_order.updated、card_operation.updated、topup_order.updated、card_transaction.updated。HMAC SHA256(secret, timestamp + \".\" + rawBody) 十六进制签名。接收方校验原始请求体与时间戳（建议五分钟窗口），按 eventId 幂等处理。最多八次退避重试；停用或换地址后旧事件不转发。",
        "parameters": [
          {
            "name": "X-9aipay-Event-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "事件唯一编号，按此幂等。"
          },
          {
            "name": "X-9aipay-Timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Unix 秒级时间戳；签名使用请求头中的原始字符串。"
          },
          {
            "name": "X-9aipay-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "HMAC-SHA256 十六进制签名。"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "eventId",
                  "type",
                  "createdAt",
                  "data"
                ],
                "properties": {
                  "eventId": {
                    "type": "string"
                  },
                  "type": {
                    "enum": [
                      "card_order.updated",
                      "card_operation.updated",
                      "topup_order.updated",
                      "card_transaction.updated"
                    ]
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "接收成功；重复事件应安全返回成功。"
          }
        }
      }
    }
  }
}
