快速开始
接入准备、环境信息和第一个请求。
接入准备
在开始集成之前,请确保您已完成以下准备工作:
- 获取凭证: 联系 Stabo 客户经理获取
client_id、client_secret和tenant_id - 配置 IP 白名单: 提供商户服务器出口 IP 地址
- 配置 Webhook URL: 提供可公网访问的 HTTPS 回调地址
- 生成幂等键: 所有
POST请求必须提供唯一的Idempotency-Key
环境信息
| 环境 | Base URL | 说明 |
|---|---|---|
| 测试环境 | https://api.test.stabofx.com | 用于开发和测试 |
| 生产环境 | https://api.stabo.io | 正式生产环境 |
第一个请求
以下是一个完整的调用流程示例。
步骤 1: 获取 Access Token
curl -X POST "https://api.stabo.io/oauth2/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "X-Tenant-ID: your_tenant_id" \
-H "X-Tenant-Type: COMPANY" \
-d "grant_type=client_credentials&client_id=your_client_id&client_secret=your_client_secret&scope=company:TENANT:admin"步骤 2: 调用业务接口
以 Checkout 的创建 Payment Intent 为例。金额用标准单位十进制字符串。"20.00" 表示 20.00 USD。
curl -X POST "https://api.stabo.io/openapi/v1/payment-intents" \
-H "Authorization: Bearer {accessToken}" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: pi_20260511_0001" \
-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"
}
}'