管理员

GET /core/v1/admin/topup-orders

管理员测试订单;不返回支付链接

Stripe 仍关闭,其接口仅支持测试模式。全局 payment_enabled 不能证明 Stripe 可用。webhook 必须由服务端校验官方签名和未经改写的原始字节,不可由前端伪造。

身份要求

管理员. 会话/管理写操作不在公共 Playground 执行。

接口

curl --request GET 'https://api.oneaster.ai/core/v1/admin/topup-orders' \
  --header 'Authorization: Bearer '"$ONEASTER_SESSION_TOKEN"

参数

- page (query, 可选): {"type":"integer","minimum":1,"maximum":1000000,"default":1}

- size (query, 可选): {"type":"integer","minimum":1,"maximum":100,"default":20}

- state (query, 可选): {"enum":["creating","unknown","open","paid","expired","failed"]}

- user_id (query, 可选): {"type":"string","pattern":"^[1-9][0-9]*$"}

响应

200

管理员测试订单;不返回支付链接

{
  "application/json": {
    "schema": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "page": {
              "type": "integer",
              "minimum": 0
            },
            "size": {
              "type": "integer",
              "minimum": 0
            },
            "total": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "items": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "user_id": {
                    "type": "string",
                    "pattern": "^[0-9]+$"
                  },
                  "mode": {
                    "const": "test"
                  },
                  "currency": {
                    "const": "usd"
                  },
                  "amount_usd_cents": {
                    "type": "string",
                    "pattern": "^[1-9][0-9]*$",
                    "maxLength": 6,
                    "description": "USD整数美分;不是积分。1美分=10000 OneAster整数账务单位。"
                  },
                  "credit_micro": {
                    "type": "string",
                    "pattern": "^[0-9]+$",
                    "description": "整数账务单位;1 积分 = 10000 单位,1 USD = 100 积分。前端用 BigInt。"
                  },
                  "state": {
                    "enum": [
                      "creating",
                      "unknown",
                      "open",
                      "paid",
                      "expired",
                      "failed"
                    ]
                  },
                  "stripe_session_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "checkout_url": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uri",
                        "description": "仅本人未支付open订单返回;仅checkout.stripe.com可信URL。"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "created_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "updated_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "paid_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "user_id",
                  "mode",
                  "currency",
                  "amount_usd_cents",
                  "credit_micro",
                  "state",
                  "stripe_session_id",
                  "checkout_url",
                  "created_at",
                  "updated_at",
                  "paid_at"
                ]
              }
            }
          },
          "required": [
            "page",
            "size",
            "total",
            "items"
          ]
        }
      },
      "required": [
        "success",
        "data"
      ]
    }
  }
}

default

错误代码见 core-api.md;供应商/数据库错误已隐藏。

{
  "application/json": {
    "schema": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "success": {
          "const": false
        },
        "error": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "type": {
              "const": "oneaster_error"
            }
          },
          "required": [
            "code",
            "message",
            "type"
          ]
        },
        "data": {
          "type": "null"
        }
      },
      "required": [
        "success",
        "error",
        "data"
      ]
    }
  }
}