curl --request POST \
--url "https://api.stablepay.co/api/v1/quote" \
--header "Authorization: Bearer <API_KEY>" \
--header "X-StablePay-Timestamp: <TIMESTAMP>" \
--header "X-StablePay-Nonce: <NONCE>" \
--header "X-StablePay-Signature: <SIGNATURE>" \
--header "Content-Type: application/json" \
--data '{
"quote_type": "on_ramp",
"source_currency": "USD",
"target_currency": "USDC",
"amount": 100500
}'
const response = await fetch("https://api.stablepay.co/api/v1/quote", {
method: "POST",
headers: {
"Authorization": "Bearer <API_KEY>",
"X-StablePay-Timestamp": "<TIMESTAMP>",
"X-StablePay-Nonce": "<NONCE>",
"X-StablePay-Signature": "<SIGNATURE>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"quote_type": "on_ramp",
"source_currency": "USD",
"target_currency": "USDC",
"amount": 100500
})
});
console.log(await response.json());
{
"quote_id": "9000000017",
"quote_type": "on_ramp",
"source_currency": "USD",
"target_currency": "USDC",
"source_amount": 100500,
"target_amount": 100479,
"rate": "0.9998",
"fee_amount": 5,
"fee_currency": "USD",
"expires_at": 1718730000,
"status": "open",
"created": 1718726400
}
稳定币兑换 API
创建报价并锁定汇率
创建报价并锁定汇率
POST
/
api
/
v1
/
quote
curl --request POST \
--url "https://api.stablepay.co/api/v1/quote" \
--header "Authorization: Bearer <API_KEY>" \
--header "X-StablePay-Timestamp: <TIMESTAMP>" \
--header "X-StablePay-Nonce: <NONCE>" \
--header "X-StablePay-Signature: <SIGNATURE>" \
--header "Content-Type: application/json" \
--data '{
"quote_type": "on_ramp",
"source_currency": "USD",
"target_currency": "USDC",
"amount": 100500
}'
const response = await fetch("https://api.stablepay.co/api/v1/quote", {
method: "POST",
headers: {
"Authorization": "Bearer <API_KEY>",
"X-StablePay-Timestamp": "<TIMESTAMP>",
"X-StablePay-Nonce": "<NONCE>",
"X-StablePay-Signature": "<SIGNATURE>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"quote_type": "on_ramp",
"source_currency": "USD",
"target_currency": "USDC",
"amount": 100500
})
});
console.log(await response.json());
{
"quote_id": "9000000017",
"quote_type": "on_ramp",
"source_currency": "USD",
"target_currency": "USDC",
"source_amount": 100500,
"target_amount": 100479,
"rate": "0.9998",
"fee_amount": 5,
"fee_currency": "USD",
"expires_at": 1718730000,
"status": "open",
"created": 1718726400
}
完整认证、签名、数据约定与错误响应。每次重试均须重新生成时间戳、nonce 与签名。
POST /quote 锁定汇率与费用的单次凭据,有效期见 expires_at。
请求头
string
必填
Bearer API Key。
string
必填
Unix 秒,允许与服务端相差最多 5 分钟。
string
必填
每次请求唯一的随机串,16–64 字符。
string
必填
HMAC-SHA256 签名,小写十六进制;签名必须对应实际发送的请求体。
string
幂等键
请求参数
string
10 位数字
string
必填
on_ramp、off_ramp、swapstring
必填
卖出币种
string
必填
买入币种
integer
必填
卖出金额,源币种最小单位
object
自定义元数据
响应
string
必填
报价 ID,10 位数字
string
必填
on_ramp、off_ramp、swapstring
必填
卖出币种
string
必填
买入币种
integer
必填
卖出金额,源币种最小单位
integer
必填
买入金额
string
必填
锁定汇率,十进制字符串
integer
必填
手续费,源币种最小单位
string
必填
费用币种
integer
必填
过期时间
string
必填
open、used、expired
object
自定义元数据
integer
必填
创建时间
状态与错误
400 参数不合法或交易对不支持。curl --request POST \
--url "https://api.stablepay.co/api/v1/quote" \
--header "Authorization: Bearer <API_KEY>" \
--header "X-StablePay-Timestamp: <TIMESTAMP>" \
--header "X-StablePay-Nonce: <NONCE>" \
--header "X-StablePay-Signature: <SIGNATURE>" \
--header "Content-Type: application/json" \
--data '{
"quote_type": "on_ramp",
"source_currency": "USD",
"target_currency": "USDC",
"amount": 100500
}'
const response = await fetch("https://api.stablepay.co/api/v1/quote", {
method: "POST",
headers: {
"Authorization": "Bearer <API_KEY>",
"X-StablePay-Timestamp": "<TIMESTAMP>",
"X-StablePay-Nonce": "<NONCE>",
"X-StablePay-Signature": "<SIGNATURE>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"quote_type": "on_ramp",
"source_currency": "USD",
"target_currency": "USDC",
"amount": 100500
})
});
console.log(await response.json());
{
"quote_id": "9000000017",
"quote_type": "on_ramp",
"source_currency": "USD",
"target_currency": "USDC",
"source_amount": 100500,
"target_amount": 100479,
"rate": "0.9998",
"fee_amount": 5,
"fee_currency": "USD",
"expires_at": 1718730000,
"status": "open",
"created": 1718726400
}
最后修改于 2026年10月29日
此页面对您有帮助吗?
