创建 Payment Intent

POST
/openapi/v1/payment-intents

创建 Payment Intent,生成托管收银台链接。创建成功后,把客户跳转到响应中的 checkoutUrl 完成支付。

成功返回 HTTP 200。创建后 status 为 AWAITING_PAYMENT。

鉴权

bearerAuth
header鉴权Bearer <令牌>

通过 POST /oauth2/token 获取的 access_token。请求头格式为 Authorization: Bearer {accessToken}。

Header 参数

Idempotency-Key*string

唯一请求标识,建议使用 UUID 或业务唯一流水号。同一业务请求重试时复用相同的 Key,不同业务请求必须使用不同的 Key

请求体

application/json
  1. body
amount*string

支付金额,标准单位十进制字符串,如 "20.00"。小数位不能超过币种精度(USD 为 2 位,JPY 为 0 位),超出时请求被拒绝

currency*string

法币币种,ISO 4217 代码,如 USD。不区分大小写,返回统一为大写

referenceNo*string

商户订单号或业务参考号

description?string

订单描述

customer?string

商户内部客户 ID

brand?string

展示在收银台上的品牌名

successUrl*string

支付成功后的跳转地址

cancelUrl*string

客户取消支付后的跳转地址

expiryMinutes?integer

收银台有效期,单位为分钟,默认 30

默认值30
metadata?

商户自定义元数据

响应体

返回 Payment Intent 对象。

application/json
  1. response
code?integer

业务状态码

message?string
traceId?string

请求追踪 ID。联系技术支持时请提供

data?

Payment Intent 对象。金额字段都是标准单位十进制字符串,按币种精度输出。时间字段都是 ISO 8601 格式,带时区偏移。值为空的字段不返回。

请求示例
curl -X POST 'https://api.test.stabofx.com/openapi/v1/payment-intents' \  -H 'Idempotency-Key: pi_20260511_0001' \  -H 'Content-Type: application/json' \  -d '{  "amount": "20.00",  "currency": "USD",  "referenceNo": "ORD-20260511-0001",  "description": "Order #20260511-0001",  "customer": "cus_123456",  "brand": "Acme Coffee",  "successUrl": "https://merchant.example.com/success",  "cancelUrl": "https://merchant.example.com/cancel",  "expiryMinutes": 30,  "metadata": {    "orderId": "ORD-20260511-0001",    "merchantUserId": "user_123456"  }}'
响应示例
{  "code": 200,  "message": "OK",  "traceId": "6a017352cef4f5dd023f6f4479faf669",  "data": {    "paymentIntentId": "pi_MNOL0POUV8IDPXCD",    "status": "AWAITING_PAYMENT",    "clientSecret": "v1.xxx",    "checkoutUrl": "https://app.test.stabofx.com/en/checkout/pi_MNOL0POUV8IDPXCD?secret=v1.xxx",    "amount": "20.00",    "currency": "USD",    "referenceNo": "ORD-20260511-0001",    "description": "Order #20260511-0001",    "customer": "cus_123456",    "brand": "Acme Coffee",    "receivedAmount": "0.00",    "refundedAmount": "0.00",    "hasRefund": false,    "expiresAt": "2026-05-11T14:42:34+08:00",    "createdAt": "2026-05-11T14:12:34+08:00",    "metadata": {      "orderId": "ORD-20260511-0001",      "merchantUserId": "user_123456"    },    "paymentOptions": [      {        "currency": "USDT",        "network": "Polygon"      },      {        "currency": "USDC",        "network": "Ethereum"      }    ]  }}