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

ElementMandatoryData TypeRemarks
appidYstringPartner unique ID, once a merchant has been on-boarded with Alchemy Pay, the merchant will be provided with the credentials with appId and appSecret
timestampYstringUTC time with 13 digit to represent time in milliseconds, expiration period is 5 minutes.
signYstringSign the appId,timeStamp, and requested parameters alphabetically,the sign method can refer here

Http Body

ElementMandatoryData TypeRemarks
cryptoYstringcrypto type, e.g: ETH, please refer to crypto query API
networkYstringcrypto network
fiatYstringfiat type, char code with ISO4217 encoding(currently there are four currency USD, EUR, JPY, GBP)
countryYstringcountry code with two letters defined in ISO 3166-1
amountYBigdecimalfiat amount, Unit in Yuan, should be between payMin and payMax of Fiat Query API output
payWayCodeNstringpayment method code, for side=BUY only
sideYstringBUY
SELL
typeCstringONE(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": {
		"cryptoPrice": "1.005",// crypto's current price
		"rampFee": "4.39",// estimated networkFee
		"cryptoNetworkFee": "17.48",
		"cryptoQuantity": "77.66432835",// estimated crypto amount can buy
		"networkFee": "17.55",// estimated rampFee
		"rebateFiatAmount": "0.00",//rebate amount(priced in fiat)
		"fiat": "USD",//fiat
		"rebateUsdAmount": "0.00",//rebate amount(priced in USD)
		"crypto": "USDT",
		"payWayCode": "701",
		"rampFeeInUSD": "4.39"//estimated networkFee(priced in USD)
	},
	"traceId": "65ead7efaf51f85e7df2be0eea35f249"
}
# side:BUY,type:ALL 
{
	"success": true,
	"returnCode": "0000",
	"returnMsg": "SUCCESS",
	"extend": "",
	"data": [
		{
			"cryptoPrice": "1.005",
			"rampFee": "4.39",
			"cryptoNetworkFee": "14.67",
			"cryptoQuantity": "80.47432835",
			"networkFee": "14.73",
			"rebateFiatAmount": "0.00",
			"fiat": "USD",
			"rebateUsdAmount": "0.00",
			"crypto": "USDT",
			"payWayCode": "501",
			"rampFeeInUSD": "4.39"
		},
		{
			"cryptoPrice": "1.005",
			"rampFee": "4.39",
			"cryptoNetworkFee": "14.67",
			"cryptoQuantity": "80.47432835",
			"networkFee": "14.73",
			"rebateFiatAmount": "0.00",
			"fiat": "USD",
			"rebateUsdAmount": "0.00",
			"crypto": "USDT",
			"payWayCode": "701",
			"rampFeeInUSD": "4.39"
		},
		{
			"cryptoPrice": "1.005",
			"rampFee": "4.39",
			"cryptoNetworkFee": "14.67",
			"cryptoQuantity": "80.47432835",
			"networkFee": "14.73",
			"rebateFiatAmount": "0.00",
			"fiat": "USD",
			"rebateUsdAmount": "0.00",
			"crypto": "USDT",
			"payWayCode": "10001",
			"rampFeeInUSD": "4.39"
		}
	],
	"traceId": "65ead98b7c71e3e632e88873583e65a7"
}
# 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.