Z Zise Developers

转账试算(不动钱 · 不建单 · 不占额度)

POST /v1/transfers/quotes scope: transfers:read
代会员调用 · 必带 x-on-behalf-of

确认页上的「实扣」与「实收」。与 POST /v1/transfers 共用同一份算法 —— 各算一份的下场是确认页显示 5、实际扣 8,而两边都 200。

限额闸在这一步就会拒:在确认页上就告诉用户「超日限额」,比让他按下确认再被拒好。用的是与提交同一组错误码。

⚠ 这一条不是报价锁定。站内转账没有报价单 —— 它是原子的、即时的,费率来自配置而不是行情。两次调用之间只有运营改了配置才会变。

字段类型必填说明
x-on-behalf-of string 必填

请求体

字段类型必填说明
asset string 必填
recipient_type string 可选 缺省 uid必须是 GET /v1/transfers/configrecipient_types 里有的那几档 —— 传一个没开的一律拒。
recipient string 必填
amount string 必填 定点十进制串(位数 = 该资产 ledger_scale)。

响应

200OK
{
  "asset": "USDT",
  "ledger_scale": 6,
  "display_scale": 2,
  "amount": "100.000000",
  "fee": "0.000000",
  "fee_payer": "sender",
  "sender_debit": "100.000000",
  "receiver_credit": "100.000000",
  "require_step_up": true
}
400POST /v1/transfers 同一组码:invalid_request · product_not_available 总闸关着 · request_rejected · member_context_required · member_not_found
请求
curl -X POST 'https://api.zise.com/v1/transfers/quotes' \
  -H 'x-auth-token: Bearer $TOKEN' \
  -H 'x-on-behalf-of: $MEMBER_ID' \
  -H 'content-type: application/json' \
  -d '{
    "asset": "USDT",
    "recipient_type": "email",
    "recipient": "someone@example.com",
    "amount": "100.00"
  }'
const res = await fetch("https://api.zise.com/v1/transfers/quotes", {
  method: "POST",
  headers: {
    "x-auth-token": "Bearer $TOKEN",
    "x-on-behalf-of": "$MEMBER_ID",
    "content-type": "application/json",
  },
  body: JSON.stringify({
    "asset": "USDT",
    "recipient_type": "email",
    "recipient": "someone@example.com",
    "amount": "100.00"
  }),
});
// 金额按字符串读,别让它变成 number
const data = await res.json();
import requests

res = requests.post(
    "https://api.zise.com/v1/transfers/quotes",
    headers={
        "x-auth-token": "Bearer $TOKEN",
        "x-on-behalf-of": "$MEMBER_ID",
        "content-type": "application/json",
    },
    json={
      "asset": "USDT",
      "recipient_type": "email",
      "recipient": "someone@example.com",
      "amount": "100.00"
    },
)
# 金额用 Decimal(str(...)),不要 float
data = res.json()
req, _ := http.NewRequest("POST", "https://api.zise.com/v1/transfers/quotes",
    strings.NewReader(`{
  "asset": "USDT",
  "recipient_type": "email",
  "recipient": "someone@example.com",
  "amount": "100.00"
}`))
req.Header.Set("x-auth-token", "Bearer $TOKEN")
req.Header.Set("x-on-behalf-of", "$MEMBER_ID")
req.Header.Set("content-type", "application/json")
res, err := http.DefaultClient.Do(req)
// 金额字段用 string 接,不要 float64
HttpRequest req = HttpRequest.newBuilder()
    .uri(URI.create("https://api.zise.com/v1/transfers/quotes"))
    .header("x-auth-token", "Bearer $TOKEN")
    .header("x-on-behalf-of", "$MEMBER_ID")
    .header("content-type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("""
{
  "asset": "USDT",
  "recipient_type": "email",
  "recipient": "someone@example.com",
  "amount": "100.00"
}
"""))
    .build();
// 金额字段用 String / BigDecimal,不要 double
$ch = curl_init('https://api.zise.com/v1/transfers/quotes');
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    'x-auth-token: Bearer $TOKEN',
    'x-on-behalf-of: $MEMBER_ID',
    'content-type: application/json',
  ],
  CURLOPT_POSTFIELDS => <<<'JSON'
{
  "asset": "USDT",
  "recipient_type": "email",
  "recipient": "someone@example.com",
  "amount": "100.00"
}
JSON,
]);
$res = curl_exec($ch);
// 金额用 bcmath / 字符串,不要 floatval
200
{
  "asset": "USDT",
  "ledger_scale": 6,
  "display_scale": 2,
  "amount": "100.000000",
  "fee": "0.000000",
  "fee_payer": "sender",
  "sender_debit": "100.000000",
  "receiver_credit": "100.000000",
  "require_step_up": true
}