## Signature Parameters
Element | Description | Remarks |
timestamp | Thirteen-digit timestamp | 1538054050234 |
httpMethod | Request Method GET/POST | request method must be in uppercase. |
requestPath | Request Path | on rampοΌ/index/rampPageBuy off ramp: /index/rampPageSell |
bodyString | bodyString | GETοΌempty POSTοΌbody parameters |
## Step 1: Generate An Encrypted String
The signature string is fixed as follows: timestamp + httpMethod + requestPath + bodyString.
For the parameters in requestPath, sort them in dictionary order and remove any empty values.
Finally, encrypt using HMAC SHA256 with the SecretKey and encode it using Base64 to obtain the sign.
### On Ramp ExampleοΌ
request linkοΌ`
https://ramptest.alchemypay.org?appId=f83Is2y7L425rxl8&crypto=USDT&network=ETH&showTable=buy&fiat=USD&fiatAmount=30×tamp=1538054050234&sign=JY9JcOwBosncT19Nn9DIfTH%2BvfSt6xL%2BI%2BRVCl9YGgE%3D
`
httpMethodοΌGET
requestPathοΌ/index/rampPageBuy
bodyStringοΌ
Signature String οΌ `
1538054050234GET/index/rampPageBuy?appId=f83Is2y7L425rxl8&crypto=USDT&fiat=USD&fiatAmount=30&network=ETH&showTable=buy×tamp=1538054050234
`
### Off Ramp Example
request linkοΌ`
https://ramptest.alchemypay.org?appId=f83Is2y7L425rxl8&crypto=USDT&network=ETH&showTable=sell&fiat=USD&cryptoAmount=30×tamp=1538054050234&sign=615hNootKL4aScndVHxqRnuZzoLDCJU%2FBzhHj913qlk%3D
`
timestampοΌ1538054050234
httpMethodοΌGET
requestPathοΌ/index/rampPageSell
bodyStringοΌ
Signature StringοΌ `
1538054050234GET/index/rampPageSell?appId=f83Is2y7L425rxl8&crypto=USDT&cryptoAmount=30&fiat=USD&network=ETH&showTable=sell×tamp=1538054050234
`
## Step Two: Generate Your Signature
Use the encrypted string and secret as parameters to generate a signature as follows
βx71β
package v4.onramp;
β
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Collectors;
//example for onramp
public class V4OnrampPage{
β
public static void main(String[] args) throws Exception {
// Generate current timestamp in milliseconds
String timestamp = String.valueOf(System.currentTimeMillis());
String httpMethod = "GET";
String requestPath = "/index/rampPageBuy";// onramo:/index/rampPageBuy offramp:/index/rampPageSell
String secretKey = "*****"; // relpace with your secretKey
String appId = "*****"; // relpace with your appId
//Replace with the token from the getToken API.
//String token = "****";
// Request parameters
Map<String, String> paramsToSign = new TreeMap<>();
paramsToSign.put("crypto", "USDT");
//paramsToSign.put("token", token);
ο»Ώ