{
  "openapi": "3.0.3",
  "info": {
    "title": "苏岛代理充值 API",
    "version": "1.0.0",
    "description": "仅代理服务器调用。首次充值绑定代理身份；幂等字段为 client_request_id。只允许已有 SD 卡密兑换，不提供发码或资金管理。"
  },
  "servers": [
    {
      "url": "https://zovotao.aishoppi.com/api/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "AgentBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "站主后台生成的 sk_sd_ API Key"
      }
    },
    "schemas": {
      "Order": {
        "type": "object",
        "properties": {
          "order_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_request_id": {
            "type": "string",
            "minLength": 8,
            "maxLength": 80,
            "pattern": "^[A-Za-z0-9._:-]{8,80}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "waiting_card",
              "needs_account",
              "submitting",
              "processing",
              "completed",
              "review"
            ]
          },
          "plan": {
            "type": "string",
            "enum": [
              "plus",
              "go",
              "pro_5x",
              "pro_20x",
              "pro_50x"
            ]
          },
          "country": {
            "type": "string",
            "enum": [
              "PH",
              "EG",
              "CL"
            ]
          },
          "plan_name": {
            "type": "string"
          },
          "account_email": {
            "type": "string",
            "description": "脱敏邮箱"
          },
          "message": {
            "type": "string"
          },
          "can_resume": {
            "type": "boolean"
          },
          "poll_after_ms": {
            "type": "integer",
            "example": 10000
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string"
          },
          "replayed": {
            "type": "boolean"
          }
        },
        "required": [
          "order_id",
          "client_request_id",
          "status",
          "plan",
          "country",
          "can_resume",
          "poll_after_ms"
        ]
      }
    }
  },
  "paths": {
    "/products": {
      "get": {
        "summary": "查询套餐和地区",
        "security": [
          {
            "AgentBearer": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "enum": [
                        0
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "products": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "plan": {
                                "type": "string",
                                "enum": [
                                  "plus",
                                  "go",
                                  "pro_5x",
                                  "pro_20x",
                                  "pro_50x"
                                ]
                              },
                              "name": {
                                "type": "string"
                              },
                              "country": {
                                "type": "string",
                                "enum": [
                                  "PH",
                                  "EG",
                                  "CL"
                                ]
                              },
                              "region_name": {
                                "type": "string"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "code_prefix": {
                                "type": "string"
                              },
                              "enabled": {
                                "type": "boolean"
                              }
                            },
                            "required": []
                          }
                        }
                      },
                      "required": []
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误，检查 HTTP 状态及非零 code；429 可能来自代理层而没有 JSON 正文。",
            "headers": {
              "Retry-After": {
                "description": "429 时建议等待秒数；缺失时至少等待30秒",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "integer"
                        }
                      ]
                    },
                    "data": {
                      "nullable": true
                    },
                    "message": {
                      "type": "string"
                    },
                    "retry_after": {
                      "type": "integer"
                    }
                  },
                  "required": []
                }
              }
            }
          }
        }
      }
    },
    "/codes/verify": {
      "post": {
        "summary": "校验本站卡密，不消耗卡密",
        "security": [
          {
            "AgentBearer": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "enum": [
                        0
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "valid": {
                          "type": "boolean"
                        },
                        "plan": {
                          "type": "string",
                          "enum": [
                            "plus",
                            "go",
                            "pro_5x",
                            "pro_20x",
                            "pro_50x"
                          ]
                        },
                        "country": {
                          "type": "string",
                          "enum": [
                            "PH",
                            "EG",
                            "CL"
                          ]
                        },
                        "plan_name": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "can_redeem": {
                          "type": "boolean"
                        },
                        "order_id": {
                          "type": "string",
                          "format": "uuid",
                          "nullable": true
                        }
                      },
                      "required": []
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误，检查 HTTP 状态及非零 code；429 可能来自代理层而没有 JSON 正文。",
            "headers": {
              "Retry-After": {
                "description": "429 时建议等待秒数；缺失时至少等待30秒",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "integer"
                        }
                      ]
                    },
                    "data": {
                      "nullable": true
                    },
                    "message": {
                      "type": "string"
                    },
                    "retry_after": {
                      "type": "integer"
                    }
                  },
                  "required": []
                }
              }
            }
          }
        }
      }
    },
    "/recharges/preview": {
      "post": {
        "summary": "预览账号，生成5分钟确认令牌",
        "security": [
          {
            "AgentBearer": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "session_payload": {
                    "type": "string",
                    "description": "完整 Session JSON 序列化字符串，最多 64 KiB；必须与预览时逐字一致。"
                  }
                },
                "required": [
                  "code",
                  "session_payload"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "enum": [
                        0
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "plan_name": {
                          "type": "string"
                        },
                        "plan": {
                          "type": "string",
                          "enum": [
                            "plus",
                            "go",
                            "pro_5x",
                            "pro_20x",
                            "pro_50x"
                          ]
                        },
                        "country": {
                          "type": "string",
                          "enum": [
                            "PH",
                            "EG",
                            "CL"
                          ]
                        },
                        "confirmation_token": {
                          "type": "string"
                        },
                        "expires_in": {
                          "type": "integer",
                          "example": 300
                        }
                      },
                      "required": []
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误，检查 HTTP 状态及非零 code；429 可能来自代理层而没有 JSON 正文。",
            "headers": {
              "Retry-After": {
                "description": "429 时建议等待秒数；缺失时至少等待30秒",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "integer"
                        }
                      ]
                    },
                    "data": {
                      "nullable": true
                    },
                    "message": {
                      "type": "string"
                    },
                    "retry_after": {
                      "type": "integer"
                    }
                  },
                  "required": []
                }
              }
            }
          }
        }
      }
    },
    "/recharges": {
      "post": {
        "summary": "幂等提交充值",
        "security": [
          {
            "AgentBearer": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "session_payload": {
                    "type": "string",
                    "description": "完整 Session JSON 序列化字符串，最多 64 KiB；必须与预览时逐字一致。"
                  },
                  "confirmation_token": {
                    "type": "string"
                  },
                  "client_request_id": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 80,
                    "pattern": "^[A-Za-z0-9._:-]{8,80}$"
                  },
                  "consent": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                },
                "required": [
                  "code",
                  "session_payload",
                  "confirmation_token",
                  "client_request_id",
                  "consent"
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "已受理或原单重放，不表示充值成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "enum": [
                        0
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误，检查 HTTP 状态及非零 code；429 可能来自代理层而没有 JSON 正文。",
            "headers": {
              "Retry-After": {
                "description": "429 时建议等待秒数；缺失时至少等待30秒",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "integer"
                        }
                      ]
                    },
                    "data": {
                      "nullable": true
                    },
                    "message": {
                      "type": "string"
                    },
                    "retry_after": {
                      "type": "integer"
                    }
                  },
                  "required": []
                }
              }
            }
          }
        }
      }
    },
    "/recharges/by-request": {
      "get": {
        "summary": "按代理业务请求号查询原单",
        "security": [
          {
            "AgentBearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_request_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 80,
              "pattern": "^[A-Za-z0-9._:-]{8,80}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "enum": [
                        0
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误，检查 HTTP 状态及非零 code；429 可能来自代理层而没有 JSON 正文。",
            "headers": {
              "Retry-After": {
                "description": "429 时建议等待秒数；缺失时至少等待30秒",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "integer"
                        }
                      ]
                    },
                    "data": {
                      "nullable": true
                    },
                    "message": {
                      "type": "string"
                    },
                    "retry_after": {
                      "type": "integer"
                    }
                  },
                  "required": []
                }
              }
            }
          }
        }
      }
    },
    "/recharges/{order_id}": {
      "get": {
        "summary": "查询当前代理订单",
        "security": [
          {
            "AgentBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "enum": [
                        0
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误，检查 HTTP 状态及非零 code；429 可能来自代理层而没有 JSON 正文。",
            "headers": {
              "Retry-After": {
                "description": "429 时建议等待秒数；缺失时至少等待30秒",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "integer"
                        }
                      ]
                    },
                    "data": {
                      "nullable": true
                    },
                    "message": {
                      "type": "string"
                    },
                    "retry_after": {
                      "type": "integer"
                    }
                  },
                  "required": []
                }
              }
            }
          }
        }
      }
    },
    "/recharges/{order_id}/resume": {
      "post": {
        "summary": "凭据过期后恢复原单，保留原请求号",
        "security": [
          {
            "AgentBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "session_payload": {
                    "type": "string",
                    "description": "完整 Session JSON 序列化字符串，最多 64 KiB；必须与预览时逐字一致。"
                  },
                  "confirmation_token": {
                    "type": "string"
                  },
                  "consent": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                },
                "required": [
                  "session_payload",
                  "confirmation_token",
                  "consent"
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "已受理或原单重放，不表示充值成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "enum": [
                        0
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误，检查 HTTP 状态及非零 code；429 可能来自代理层而没有 JSON 正文。",
            "headers": {
              "Retry-After": {
                "description": "429 时建议等待秒数；缺失时至少等待30秒",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "integer"
                        }
                      ]
                    },
                    "data": {
                      "nullable": true
                    },
                    "message": {
                      "type": "string"
                    },
                    "retry_after": {
                      "type": "integer"
                    }
                  },
                  "required": []
                }
              }
            }
          }
        }
      }
    }
  }
}
