本接口用于根据商户信息、订单金额等参数,试算该笔交易的手续费金额。仅限Gate Pay商户调用。
数据类型:JSON (content-type:application/json)
请求方式:POST
路径Path: /payClearing/clearing/previewMerchantFee
验证方式:签名验证
请求头(Headers):
| 字段名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| X-GatePay-Certificate-ClientId | string | 是 | 商户ID |
| X-GatePay-Signature | string | 是 | 签名 |
| X-GatePay-Timestamp | string | 是 | 时间戳(毫秒) |
| X-GatePay-Nonce | string | 是 | 随机数 |
| Content-Type | string | 是 | application/json |
| 字段名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| orderCurrency | string | 是 | 订单币种,如:USDT、USDC等 |
| accessMode | integer | 是 | 接入模式:0=中心化支付,1=Web3支付 |
| scenario | integer | 是 | 交易类型(场景):0=收款 |
| orderAmount | decimal | 是 | 订单金额,必须大于等于0 |
| 字段名 | 类型 | 说明 |
|---|---|---|
| status | string | 响应状态:success/error |
| code | string | 响应码,000000表示成功 |
| errorMessage | string | 错误信息,成功时为空 |
| data | object | 响应数据对象 |
| data.merchantId | string | 商户ID |
| data.merchantType | integer | 商户类型:0=普通商户,1=代理商 |
| data.accessMode | integer | 接入模式:0=中心化支付,1=Web3支付 |
| data.orderCurrency | string | 订单币种 |
| data.orderAmount | decimal | 订单金额 |
| data.orderFee | decimal | 计算出的手续费 |
CURL 请求
curl --location 'https://openplatform.gateapi.io/pay-merchant-gateway/clearing-gateway/clearing-service/clearing/clearing/previewMerchantFee' \
--header 'X-GatePay-Certificate-ClientId: mZ96D37oKk-HrWJc' \
--header 'Content-Type: application/json' \
--header 'X-GatePay-Timestamp: 1726027137585' \
--header 'X-GatePay-Nonce: 2290830087' \
--header 'X-GatePay-Signature: 601d560c54d53412aca5901256f101e7078b5779f61f30bedfe9a5f0b92f049589952a151ea477371e4a99ac0e1c3cc8dec62654b3c6a1794ef981efe19232bc' \
--data '{
"orderCurrency": "USDT",
"accessMode": 0,
"scenario": 0,
"orderAmount": "100.00"
}'
响应:
{
"status": "success",
"code": "000000",
"errorMessage": "",
"data": {
"merchantId": "123456789",
"merchantType": 1,
"accessMode": 0,
"orderCurrency": "USDT",
"orderAmount": 100.00,
"orderFee": 2.50
}
}
| 错误码 | 描述 | 解决方案 |
|---|---|---|
400001 | 无效请求参数 | 请检查请求参数是否合法 |
400002 | 无效签名 | 检查签名算法是否正确 |
400004 | API身份秘钥不存在或无效 | 检查API身份密钥是否存在或有效 |
400005 | INVALID_CLIENT_ID/clientid错误 | 检查客户端ID是否正确 |
400007 | 不支持的media type | 查看接口支持的media type |
503011007 | 调用费率服务试算接口失败 | 检查商户费率配置是否正确 |
503011008 | 商户费率配置为空 | 检查商户是否已配置费率规则 |
503010999 | 未知错误 | 其它异常码参考官方文档 |