管理员

POST /core/v1/admin/topup-orders/{id}/reconcile

对已知Session只读查证并原子核账;不创建付款会话

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

身份要求

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

接口

curl --request POST 'https://api.oneaster.ai/core/v1/admin/topup-orders/00000000-0000-4000-8000-000000000001/reconcile' \
  --header 'Authorization: Bearer '"$ONEASTER_SESSION_TOKEN"

参数

- id (path, 必填): {"type":"string","format":"uuid"}

响应

200

对已知Session只读查证并原子核账;不创建付款会话

{
  "application/json": {
    "schema": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "order": {
              "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"
              ]
            },
            "reused": {
              "type": "boolean"
            }
          },
          "required": [
            "order",
            "reused"
          ]
        }
      },
      "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"
      ]
    }
  }
}