返回首页

GETGPT STOREFRONT API · v1

普通买家购买 API

更新日期:2026-11-03 ·下载 Markdown 版本

普通买家无需注册、登录或申请 API Key。流程与常见数字商品商城一致:读取商品、提交邮箱创建订单、打开返回的支付链接付款,再凭订单号和一次性返回的订单令牌查询支付与交付状态。

请求约定

项目约定
基础地址https://getgpt.homes
数据格式application/json; charset=utf-8
成功响应{ code, msg, data },code 为对应 HTTP 状态码
错误响应{ code, msg, error, data: null },error 为稳定错误码
创建幂等可选 Idempotency-Key 请求头;同一邮箱和键只会创建一笔订单
订单鉴权Authorization: Bearer <order_token>
限流创建 10 次/分钟/IP、20 次/小时/邮箱;查单 120 次/10 分钟/IP+订单

接口列表

方法路径用途
GET/api/v1/products在售商品、价格、档位、库存与可用支付方式
GET/api/v1/products/{slug}单个商品详情
GET/api/v1/payment-methods当前可用支付方式和 USDT 网络
POST/api/v1/orders创建普通买家订单并返回支付链接
GET/api/v1/orders/{tradeNo}查询支付、补货、退款和交付状态
POST/api/v1/orders/{tradeNo}/payments/next创建两笔支付商品的下一笔支付链接

商品查询

商品价格、档位、库存状态和数量阶梯价都来自实时商品目录。库存为零时仍允许创建订单;付款后进入补货等待,补货完成会自动交付。

curl https://getgpt.homes/api/v1/products

curl https://getgpt.homes/api/v1/products/chatgpt-plus-ios-us-card

创建订单

字段类型必填说明
product_slugstring是商品列表中的 slug
emailstring是购买邮箱,用于通知和网页订单找回
variant_idinteger否商品档位 ID;不传时使用默认档位
quantityinteger否购买数量,默认 1,最多 99;商品支持情况以详情为准
payment_methodstring否wechat 或 usdt,默认 wechat
trade_typestring否USDT 网络,如 usdt.bep20

请求示例

{
  "product_slug": "chatgpt-plus-ios-us-card",
  "email": "buyer@example.com",
  "quantity": 1,
  "payment_method": "wechat",
  "variant_id": 1
}

成功响应

{
  "code": 201,
  "msg": "success",
  "data": {
    "order": {
      "trade_no": "GG20261103123000A1B2C3D4",
      "state": "pending",
      "status": "pending",
      "product_slug": "chatgpt-plus-ios-us-card",
      "product_name": "ChatGPT Plus 美区卡密(iOS)",
      "quantity": 1,
      "amount": "115.00",
      "currency": "CNY",
      "payment_method": "wechat",
      "payment_url": "https://checkout.example.com/...",
      "payment_expires_at": "2026-11-03T13:00:00.000Z",
      "delivery": [],
      "message": "订单已创建,请完成支付。"
    },
    "order_token": "eyJraW5kIjoiYXBpX29yZGVyIi...签名",
    "order_token_expires_at": "2026-12-03T12:30:00.000Z",
    "duplicate": false
  }
}

order_token 默认 30 天有效,仅在创建订单时返回。请与服务端订单号一起安全保存,不要在公开页面或日志中传播。

查询与轮询订单

将订单令牌放入 Bearer 请求头。订单处于交付状态时,delivery 才包含卡密或账号内容;未支付和补货中不会提前返回交付数据。

curl https://getgpt.homes/api/v1/orders/GG20261103123000A1B2C3D4 \
  -H 'authorization: Bearer eyJraW5kIjoiYXBpX29yZGVyIi...签名'
state含义
pending等待付款或仍有待支付步骤
awaiting_stock已付款,等待补货或人工确认
delivered已交付,delivery 字段可读取
refunding退款处理中
closed订单已关闭、过期或退款完成

两笔支付商品

当创建响应中的 order.status 为 partially_paid 时,调用下一笔支付接口。该接口仅对仍待支付的订单有效。

curl -X POST https://getgpt.homes/api/v1/orders/GG20261103123000A1B2C3D4/payments/next \
  -H 'authorization: Bearer eyJraW5kIjoiYXBpX29yZGVyIi...签名'

错误码

HTTPerror说明
400INVALID_REQUEST请求字段格式错误
401UNAUTHORIZED订单令牌缺失、无效或过期
404PRODUCT_NOT_FOUND商品不存在或已下架
404ORDER_NOT_FOUND订单不存在
409PRODUCT_UNAVAILABLE商品暂不可售
409VARIANT_UNAVAILABLE档位不可用
409IDEMPOTENCY_CONFLICT幂等键用于了不同订单参数
422TRADE_TYPE_UNSUPPORTEDUSDT 网络不受支持
429RATE_LIMITED请求过于频繁
503PAYMENT_NOT_CONFIGURED微信支付尚未配置
503USDT_UNAVAILABLEUSDT 支付暂时不可用

代码示例

Node.js

import crypto from "node:crypto";

const base = "https://getgpt.homes";

const created = await fetch(base + "/api/v1/orders", {
  method: "POST",
  headers: {
    "content-type": "application/json",
    "idempotency-key": crypto.randomUUID()
  },
  body: JSON.stringify({
    product_slug: "chatgpt-plus-ios-us-card",
    email: "buyer@example.com",
    quantity: 1,
    payment_method: "wechat"
  })
}).then((response) => response.json());

const orderNo = created.data.order.trade_no;
const token = created.data.order_token;

const latest = await fetch(base + "/api/v1/orders/" + orderNo, {
  headers: { authorization: "Bearer " + token }
}).then((response) => response.json());

cURL

curl -X POST https://getgpt.homes/api/v1/orders \
  -H 'content-type: application/json' \
  -H 'idempotency-key: 6d9e34bc-74e5-4d5d-a78d-4587ba6f385b' \
  -d '{
    "product_slug":"chatgpt-plus-ios-us-card",
    "email":"buyer@example.com",
    "quantity":1,
    "payment_method":"wechat"
  }'

Python

import requests

base = "https://getgpt.homes"
created = requests.post(
    base + "/api/v1/orders",
    headers={"Idempotency-Key": "6d9e34bc-74e5-4d5d-a78d-4587ba6f385b"},
    json={
        "product_slug": "chatgpt-plus-ios-us-card",
        "email": "buyer@example.com",
        "quantity": 1,
        "payment_method": "wechat",
    },
    timeout=20,
).json()

order = created["data"]["order"]
token = created["data"]["order_token"]
latest = requests.get(
    base + "/api/v1/orders/" + order["trade_no"],
    headers={"Authorization": "Bearer " + token},
    timeout=20,
).json()

说明

本 API 只面向普通买家购买。代理余额、API Key、HMAC 签名、商户订单号和回调通知已停止开放;旧 /api/open/v1/* 地址统一返回 410。

商品价格与售卖状态会实时调整,应以创建订单时的响应为准。虚拟商品交付后不支持无理由退款,失败与售后按订单状态和商品说明处理。