Price Query

Introduction

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.

Domains

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

API Description

Request Method: POST

Request Parameters

Header Parameters:

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.
signYstringSignature, you can refer to the signature here

Body Parameters:

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)
amountYBigdecimalFor BUY: fiat amount.
For SELL: quantity of crypto being sold
payWayCodeNstringpayment method code, only for side=BUY
sideYstringBUY :onramp
SELL:offramp
typeNstringONE:Return the quote of the best-priced payment method(by default)
ALL:Return the quotes of all payment methods
*for side=BUY only

Request Body Example

# parameters for purchase
{
    "crypto": "USDT",
    "network": "ETH",
    "fiat": "INR",
    "amount": "1000",
    "payWayCode": "10001",
    "side": "BUY"
}
# parameters for sell 
{
    "crypto": "USDT",
    "fiat": "HKD",
    "amount": "100",
    "side": "SELL",
    "network": "TRX"
}

Response Parameters

Response Example

# side:BUY,type:ONE 
{
	"success": true,
	"returnCode": "0000",
	"returnMsg": "SUCCESS",
	"extend": "",
	"data": {
		"cryptoPrice": "88.146",//The price of the cryptocurrency, denominated in fiat currency.
		"rampFee": "55",//ramp fee, denominated in fiat currency
		"cryptoNetworkFee": "0.86",//network fee,Denominated in crypto units
		"cryptoQuantity": "9.86",//Estimated amount of crypto the user will receive
		"networkFee": "75",//network fee,denominated in fiat currency
		"rebateFiatAmount": "0",
		"fiat": "INR",
		"rawRampFee": "55",
		"rebateUsdAmount": "0.00",
		"crypto": "USDT",
		"payWayCode": "90001",
		"rampFeeInUSD": "0.62"
	},
	"traceId": "68b964f444b80c9a904cf2b7a11111"
}
# side:BUY,type:ALL 
{
	"success": true,
	"returnCode": "0000",
	"returnMsg": "SUCCESS",
	"extend": "",
	"data": [
		{
			"cryptoPrice": "88.146",
			"rampFee": "55.00",
			"cryptoNetworkFee": "0.85",
			"cryptoQuantity": "9.86",
			"networkFee": "75",
			"rebateFiatAmount": "0",
			"fiat": "INR",
			"rawRampFee": "55.00",
			"rebateUsdAmount": "0.00",
			"crypto": "USDT",
			"payWayCode": "90001",
			"rampFeeInUSD": "0.62"
		},
		{
			"cryptoPrice": "88.146",
			"rampFee": "62.00",
			"cryptoNetworkFee": "0.85",
			"cryptoQuantity": "9.79",
			"networkFee": "75",
			"rebateFiatAmount": "0",
			"fiat": "INR",
			"rawRampFee": "62.00",
			"rebateUsdAmount": "0.00",
			"crypto": "USDT",
			"payWayCode": "52004",
			"rampFeeInUSD": "0.70"
		},
		{
			"cryptoPrice": "88.146",
			"rampFee": "62.00",
			"cryptoNetworkFee": "0.85",
			"cryptoQuantity": "9.79",
			"networkFee": "75",
			"rebateFiatAmount": "0",
			"fiat": "INR",
			"rawRampFee": "62.00",
			"rebateUsdAmount": "0.00",
			"crypto": "USDT",
			"payWayCode": "52005",
			"rampFeeInUSD": "0.70"
		},
		{
			"cryptoPrice": "88.146",
			"rampFee": "68.05",
			"cryptoNetworkFee": "0.85",
			"cryptoQuantity": "9.72",
			"networkFee": "75",
			"rebateFiatAmount": "0",
			"fiat": "INR",
			"rawRampFee": "68.05",
			"rebateUsdAmount": "0.00",
			"crypto": "USDT",
			"payWayCode": "10001",
			"rampFeeInUSD": "0.77"
		}
	],
	"traceId": "68b9645ea3bed1890483d1a111111"
}
# 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 CodeReturn Message
3100Please contact with our team to configure commission
3101Please contact with our team to configure crypto
3102Quote 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