Price Query
Description
The number of crypto currencies purchased is calculated based on the amount of incoming fiat currency, and the number returned may differ from the actual number received.
Test environment
https://openapi-test.alchemypay.org/open/api/v3/merchant/order/quote
Prod environment
https://openapi.alchemypay.org/open/api/v3/merchant/order/quote
❗️This API can only be invoked on the server side.
Http method
- POST
- Content-Type: application/json
Http Header
Element | Mandatory | Data Type | Remarks |
---|---|---|---|
appid | Y | string | Partner unique ID, once a merchant has been on-boarded with Alchemy Pay, the merchant will be provided with the credentials with appId and appSecret |
timestamp | Y | string | UTC time with 13 digit to represent time in milliseconds, expiration period is 5 minutes. |
sign | Y | string | Sign the appId,timeStamp, and requested parameters alphabetically,the sign method can refer here |
Http Body
Element | Mandatory | Data Type | Remarks |
---|---|---|---|
crypto | Y | string | crypto type, e.g: ETH, please refer to crypto query API |
network | Y | string | crypto network |
fiat | Y | string | fiat type, char code with ISO4217 encoding(currently there are four currency USD, EUR, JPY, GBP) |
country | Y | string | country code with two letters defined in ISO 3166-1 |
amount | Y | Bigdecimal | fiat amount, Unit in Yuan, should be between payMin and payMax of Fiat Query API output |
payWayCode | N | string | payment method code, for side=BUY only |
side | Y | string | BUY SELL |
type | C | string | ONE(by default) ALL for side=BUY only |
Request sample - Header
Request sample - Body
# parameters for purchase
{
"crypto": "USDT",
"network": "ETH",
"fiat": "USD",
"country": "US",
"amount": "100",
"payWayCode": "10001",
"side": "BUY"
}
# parameters for sell
{
"crypto": "USDT",
"fiat": "HKD",
"amount": "100",
"side": "SELL",
"network": "TRX"
}
Response sample
# side:BUY,type:ONE
{
"success": true,
"returnCode": "0000",
"returnMsg": "SUCCESS",
"extend": "",
"data": {
"crypto": "USDT", // crypto
"cryptoPrice": "1.0001", // crypto's current price
"cryptoQuantity": "100.11", // estimated crypto amount can buy
"fiat": "USD", //fiat
"rampFee": "4.93", // estimated rampFee
"networkFee": "0.29" // estimated networkFee
}
}
# side:BUY,type:ALL
{
"success": true,
"returnCode": "0000",
"returnMsg": "SUCCESS",
"extend": "",
"data": [
{
"cryptoPrice": "14893.45",
"rampFee": "20950.00",
"cryptoQuantity": "31.87514642",
"networkFee": "4319.10",
"fiat": "IDR",
"crypto": "USDT",
"payWayCode": "10004"
},
{
"cryptoPrice": "14893.45",
"rampFee": "20950.00",
"cryptoQuantity": "31.87514642",
"networkFee": "4319.10",
"fiat": "IDR",
"crypto": "USDT",
"payWayCode": "10006"
},
{
"cryptoPrice": "14893.45",
"rampFee": "20950.00",
"cryptoQuantity": "31.87514642",
"networkFee": "4319.10",
"fiat": "IDR",
"crypto": "USDT",
"payWayCode": "10005"
}
]
}
# side: SELL
{
"success": true,
"returnCode": "0000",
"returnMsg": "SUCCESS",
"extend": "",
"data": {
"cryptoPrice": "7.84981500000000000000", // The unit price converted from cryptocurrency to fiat
"rampFee": "29.4368", // rampFee in fiat
"cryptoQuantity": null,
"networkFee": null,
"fiat": "HKD",
"crypto": "USDT",
"fiatQuantity": "784.9815" // The fiat amount obtained by selling coins which does not subtract the rampFee.
}
}
FAQ
When you get the response below:
This error message means that the fiat or crypto you query is not configured with the appId, please contact the operation team to add the configuration.
Updated 3 days ago