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/v4/merchant/order/quote
Prod environment
https://openapi.alchemypay.org/open/api/v4/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 | Signature, you can refer to the signature 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) |
amount | Y | Bigdecimal | For BUY: it's the fiat amount, unit in dollar.(amount example: 100 = 1.00) For SELL: it's the quantity of crypto being sold. |
payWayCode | N | string | payment method code, only for side=BUY |
side | Y | string | BUY :onramp SELL :offramp |
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",
"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.
Return Code List
Return Code | Return Message |
---|---|
3100 | Please contact with our team to configure commission |
3101 | Please contact with our team to configure crypto |
3102 | Quote amount is out of the range, The Min purchase amount is XX, The max purchase amount is XX |
Other return codes reference: https://dash.readme.com/project/alchemypay/v4.0.1/docs/response-code-list
Updated 2 months ago