TIMESTAMP=$(date +%s)
NONCE=$(uuidgen)
BODY=''
SIGNATURE=$(printf '%s' "${TIMESTAMP}.${NONCE}.${BODY}" | openssl dgst -sha256 -hmac "${SECRET_KEY}" | awk '{print $NF}')
curl --request POST "https://api.stablepay.co/api/v1/payout-batches/${BATCH_ID}/submit" \
-H "Authorization: Bearer ${API_KEY}" \
-H "X-StablePay-Timestamp: ${TIMESTAMP}" \
-H "X-StablePay-Nonce: ${NONCE}" \
-H "X-StablePay-Signature: ${SIGNATURE}"
{
"code": 400,
"message": "batch total amount must be at least 3 USDC/USDT",
"errorCode": "batch_amount_too_low",
"data": null
}
{
"code": 401,
"message": "authenticated merchant is required",
"errorCode": "authentication_required",
"data": null
}
{
"code": 403,
"message": "access denied",
"errorCode": "forbidden",
"data": null
}
{
"code": 404,
"message": "batch not found",
"errorCode": "batch_not_found",
"data": null
}
{
"code": 409,
"message": "another operation is in progress, please try again later",
"errorCode": "concurrent_operation",
"data": null
}
{
"code": 500,
"message": "payout request failed",
"errorCode": "payout_error",
"data": null
}
{
"code": 503,
"message": "payout service is temporarily unavailable",
"errorCode": "service_unavailable",
"data": null
}
付款 API
提交付款批次
提交当前商户的付款批次并立即进入执行流程。
POST
/
api
/
v1
/
payout-batches
/
{batch_id}
/
submit
TIMESTAMP=$(date +%s)
NONCE=$(uuidgen)
BODY=''
SIGNATURE=$(printf '%s' "${TIMESTAMP}.${NONCE}.${BODY}" | openssl dgst -sha256 -hmac "${SECRET_KEY}" | awk '{print $NF}')
curl --request POST "https://api.stablepay.co/api/v1/payout-batches/${BATCH_ID}/submit" \
-H "Authorization: Bearer ${API_KEY}" \
-H "X-StablePay-Timestamp: ${TIMESTAMP}" \
-H "X-StablePay-Nonce: ${NONCE}" \
-H "X-StablePay-Signature: ${SIGNATURE}"
{
"code": 400,
"message": "batch total amount must be at least 3 USDC/USDT",
"errorCode": "batch_amount_too_low",
"data": null
}
{
"code": 401,
"message": "authenticated merchant is required",
"errorCode": "authentication_required",
"data": null
}
{
"code": 403,
"message": "access denied",
"errorCode": "forbidden",
"data": null
}
{
"code": 404,
"message": "batch not found",
"errorCode": "batch_not_found",
"data": null
}
{
"code": 409,
"message": "another operation is in progress, please try again later",
"errorCode": "concurrent_operation",
"data": null
}
{
"code": 500,
"message": "payout request failed",
"errorCode": "payout_error",
"data": null
}
{
"code": 503,
"message": "payout service is temporarily unavailable",
"errorCode": "service_unavailable",
"data": null
}
API 提交无需 Merchant Portal 人工审批。重复请求会继续待执行批次,或返回已经进入执行流程的当前状态;超时或连接中断时仍应先查询批次状态。
提交指定批次并立即进入执行流程,无需 Merchant Portal 人工审批。请求重试时,已进入 pending、pending_approval、processing、partially_completed 或 completed 的批次会继续执行或返回当前状态。超时或连接中断时,请先查询批次状态。
商户身份由 stablepay-auth 的认证结果确定,请求参数不得传入 merchant_id。批次状态和业务规则以 StablePay Payout 服务为准。
对象仅允许包含下列已定义字段。
认证与请求头
使用 Bearer API Key 和以下三个签名请求头。使用 API Secret 对{timestamp}.{nonce}.{requestBody} 计算 HMAC-SHA256,并转换为小写 hex。签名使用实际发送的原始请求体;不发送请求体时使用空字符串。详见认证与签名。
string
必填
Bearer API Key:
Bearer sk_live_xxx.string
必填
Unix 时间戳(秒),与服务器时间相差不超过 5 分钟。
string
必填
防重放随机字符串,每次请求使用新的 nonce。 最短字符数:16。 最长字符数:64。
string
必填
请求签名,使用小写十六进制编码。
路径参数
string
必填
最短字符数:1。 最长字符数:64。
成功响应
HTTP200, application/json. 已进入执行流程,或该批次此前已经进入执行流程。
对象仅允许包含下列已定义字段。
string
必填
string
必填
可选值:
draft、needs_fix、pending、pending_approval、processing、partially_completed、completed、failed、canceled、rejected。string
必填
可选值:
USDT、USDC。string
必填
可选值:
erc20、trc20、spl。integer
必填
最小值:0。
integer
必填
最小值:0。
integer
必填
最小值:0。
integer
必填
最小值:0。
integer
必填
最小值:0。
string
必填
非负十进制金额字符串,最多两位小数。 匹配规则:
^(0|[1-9][0-9]*)(\.[0-9]{1,2})?$。string
必填
非负十进制金额字符串,最多两位小数。 匹配规则:
^(0|[1-9][0-9]*)(\.[0-9]{1,2})?$。string
必填
非负十进制金额字符串,最多两位小数。 匹配规则:
^(0|[1-9][0-9]*)(\.[0-9]{1,2})?$。string
必填
非负十进制金额字符串,最多两位小数。 匹配规则:
^(0|[1-9][0-9]*)(\.[0-9]{1,2})?$。string
必填
非负十进制金额字符串,最多两位小数。 匹配规则:
^(0|[1-9][0-9]*)(\.[0-9]{1,2})?$。boolean
批次当前是否可以提交;status 为 canceled 时不返回。
string | null
integer
必填
格式:
int64。integer | null
格式:
int64。integer | null
格式:
int64。响应头
| 响应头 | 说明 |
|---|---|
X-Request-ID | 请求追踪 ID。 |
Cache-Control | 响应不得缓存。 可选值:no-store。 |
错误响应
| HTTP | 说明 |
|---|---|
| 400 | 请求无效或批次不满足提交条件。 |
| 401 | 鉴权失败或缺少可信商户身份。 |
| 403 | 当前商户无权访问或操作该资源。 |
| 404 | 指定的付款批次或明细不存在。 |
| 409 | 同一资源正在执行其他操作,请稍后重试。 |
| 500 | 当前未细分的付款业务错误。 |
| 503 | 付款服务超时或暂时不可用。写请求发生此错误时应先查询资源状态。 |
integer
必填
string
必填
string
必填
null
必填
相关接口
运行示例前设置 API_KEY 和 SECRET_KEY,并按接口路径设置 BATCH_ID 或 ITEM_ID。TIMESTAMP=$(date +%s)
NONCE=$(uuidgen)
BODY=''
SIGNATURE=$(printf '%s' "${TIMESTAMP}.${NONCE}.${BODY}" | openssl dgst -sha256 -hmac "${SECRET_KEY}" | awk '{print $NF}')
curl --request POST "https://api.stablepay.co/api/v1/payout-batches/${BATCH_ID}/submit" \
-H "Authorization: Bearer ${API_KEY}" \
-H "X-StablePay-Timestamp: ${TIMESTAMP}" \
-H "X-StablePay-Nonce: ${NONCE}" \
-H "X-StablePay-Signature: ${SIGNATURE}"
{
"code": 400,
"message": "batch total amount must be at least 3 USDC/USDT",
"errorCode": "batch_amount_too_low",
"data": null
}
{
"code": 401,
"message": "authenticated merchant is required",
"errorCode": "authentication_required",
"data": null
}
{
"code": 403,
"message": "access denied",
"errorCode": "forbidden",
"data": null
}
{
"code": 404,
"message": "batch not found",
"errorCode": "batch_not_found",
"data": null
}
{
"code": 409,
"message": "another operation is in progress, please try again later",
"errorCode": "concurrent_operation",
"data": null
}
{
"code": 500,
"message": "payout request failed",
"errorCode": "payout_error",
"data": null
}
{
"code": 503,
"message": "payout service is temporarily unavailable",
"errorCode": "service_unavailable",
"data": null
}
最后修改于 2026年10月19日
此页面对您有帮助吗?
