Following is a sample request to get data via supported REST APIs
Below is a sample code that demonstrates how to fetch information from merchant REST endpoints, You can call all the merchant endpoints in a similar manner, making sure to update the endpoint URLs and parameters passed in the request body as needed.
var CryptoJS =require('crypto-js');var axios =require('axios');asyncfunctiongetAllTransactions() {try {let body = { page:1, pageSize:50 }let payload = { timestamp:newDate().getTime(), body: body }let apiKey ='API_KEY', apiSecret ='API_SECRET'; payload =Buffer.from(JSON.stringify(payload)).toString('base64');let signature =CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA512(payload, apiSecret));let options = { url:'https://api.onramp.money/onramp/api/v1/transaction/merchantHistory', method:'POST', headers: {'Accept':'application/json','Content-Type':'application/json;charset=UTF-8','X-ONRAMP-SIGNATURE': signature,'X-ONRAMP-APIKEY': apiKey,'X-ONRAMP-PAYLOAD': payload }, data: body };let data =awaitaxios(options)console.log(data?.data); } catch (error) {console.log(error?.response?.data) }}getAllTransactions();