Merchant Transaction History
POST
https://api.onramp.money/onramp/api/v1/transaction/merchantHistory
Headers
Name | Type | Description |
---|---|---|
X-ONRAMP-APIKEY* | String | Your api key |
X-ONRAMP-PAYLOAD* | String | payload generated for the request |
X-ONRAMP-SIGNATURE* | String | signature generated for the request |
Request Body
Name | Type | Description |
---|---|---|
page | Integer | Default value 1 |
pageSize | Integer | Min: 1, Max: 500, Default: 50 |
since | String | '2022-10-07T22:29:52.000Z' |
order | String | ASC or DESC (ASC for ascending order of data DESC for descending, Default: ASC) |
type | Integer | 1 -> Onramp 2 -> Offramp Onramp transactions are returned incase the field is empty. |
fiatType | String | 1 -> India (Default) INR 2 -> Turkey (TRY) 3 -> Arab Emirates Dirham (AED) 4 -> Mexican Peso (MXN) 5 -> Vietnamese dong (VND) |
{
"status": 1,
"data": [
{
"orderId": 3,
"userId": 1,
"walletAddress": "012bahscbx",
"coinId": 54,
"fiatType": 1,
"fiatAmount": 100,
"expectedCryptoAmount": 46.23,
"expectedPrice": 73,
"createdAt": "2022-07-26T11:51:06.000Z",
"appId": -1,
"status": 0,
"chainId": 3,
"onRampFee": 0.25,
"gatewayFee": 0,
"clientFee": 0,
"gasFee": 0.23,
"actualCryptoAmount": null,
"actualPrice": null,
"hashId": null,
"referenceId": null,
"kycNeeded": 0,
"trials": 0
}
],
"code": 200
}
Note -
Transactions updated on or before "2022-11-09T16:58:07.000Z" UTC will have "2022-11-09T16:58:07.000Z" as the updatedAt field value. Transactions thereon will have the actual last updated timestamp.
For Status codes and its meaning, please to refer to link.
Sample Request
var CryptoJS = require('crypto-js');
var axios = require('axios');
async function getAllTransactions() {
try {
let body = {
page: 1,
pageSize: 50,
since: '2022-10-07T22:29:51.999Z',
order: 'DESC', // ASC or DESC
type: 1 // 1 -> onramp, 2 -> offramp
}
let payload = {
timestamp: new Date().getTime(),
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 = await axios(options)
console.log(data?.data);
} catch (error) {
console.log(error?.response?.data)
}
}
getAllTransactions();
import json
import time
import base64
import hmac
import hashlib
import requests
def merchant_history():
try:
body = {
'page': 1,
'pageSize': 50,
'since': '2022-10-07T22:29:51.999Z',
'order': 'DESC', # ASC or DESC
'type': 1 # 1 -> onramp, 2 -> offramp
}
payload = {
"timestamp": int(time.time() * 1000), # to get timestamp in milliseconds
"body": body
}
api_key = 'API_KEY'
api_secret = 'API_SECRET'
payload = base64.b64encode(json.dumps(payload).encode()).decode()
signature = hmac.new(api_secret.encode(), payload.encode(), hashlib.sha512).hexdigest()
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json;charset=UTF-8',
'X-ONRAMP-SIGNATURE': signature,
'X-ONRAMP-APIKEY': api_key,
'X-ONRAMP-PAYLOAD': payload
}
url = 'https://api.onramp.money/onramp/api/v1/transaction/merchantHistory'
response = requests.post(url, headers=headers, data=json.dumps(body))
print(response.json())
except Exception as e:
print(str(e))
merchant_history()
// Onramp resopnse
{
"status":1,
"data":[
{
"orderId":338,
"walletAddress":"0x72c6668306f1d89425e86899b7444a0c2e5f25cf",
"coinId":54,
"fiatType":1,
"paymentType":1,
"expectedPrice":87,
"fiatAmount":250,
"expectedCryptoAmount":2.61,
"actualPrice":0,
"actualCryptoAmount":2.87,
"kycNeeded":0,
"createdAt":"2022-10-07T22:29:52.000Z",
"updatedAt":"2022-11-09T16:58:07.000Z",
"status":5,
"transactionHash":"0x0ba7ec6883efb0aj7c3cd746a5fe77e82a599efcf03350667d91av70126a2169",
"referenceId":"228066179164",
"chainId":3,
"onRampFee":0.63,
"gasFee":0.25,
"clientFee":0,
"gatewayFee":0,
"merchantRecognitionId":"23"
}
],
"code":200
}
//Offramp response
{
"status":1,
"data":[
{
"orderId":517,
"coinId":54,
"chainId":3,
"walletAddress":"0x9C85C3761E0721c759b8015AC22EfE066dbB73EC",
"expectedPrice":86,
"expectedQuantity":1115,
"onrampFee":2.79,
"clientFee":0,
"gatewayFee":8.26,
"tdsFee":11.12,
"merchantRecognitionId":'23',
"paymentType":1,
"fiatType":1,
"actualPrice":86,
"actualQuantity":1115,
"actualFiatAmount":94685.48,
"createdAt":"2023-03-31T05:26:18.000Z",
"updatedAt":"2023-03-31T05:27:16.000Z",
"status":6,
"transactionHash":"0xe1s635ef8c1386c30dcdc176d85294c457bceea87289193cc4fb6046f110a070"
}
]
}
Onramp Explanation
status -> 0 is for unsuccessful request, 1 is for a successful one
orderId -> order id of the transaction
walletAddress -> Onchain wallet address to which the crypto was withdrawn to.
coinId -> Id of the coin (e.g. 54 denotes to USDT)
fiatType -> fiat type used for the transaction
1 -> INR (Indian Rupee)
2 -> TRY (Turkish lira)
3 -> Arab Emirates Dirham (AED)
4 -> Mexican Peso (MXN)
5 -> Vietnamese dong (VND)
paymentType -> payment method in fiat
1 -> Instant transfer (e.g. UPI)
2 -> Bank transfer (e.g. IMPS/FAST)
fiatAmount -> Amount of fiat received by the onramp.money.
expectedCryptoAmount -> amount of crypto estimate shown at the beginning of the transaction
expectedPrice -> expected price estimate shown at the beginning of the transaction
createdAt -> time at which the transaction was created.
appId -> App Id of the merchant/Partner.
status -> denotes the status of the order
-4 -> wrong amount sent
-3 -> bank and kyc name mismatch
-2 -> transaction abandoned
-1 -> transaction timed out
0 -> transaction created
1 -> referenceId claimed
2 -> deposit secured
3, 13 -> crypto purchased
4, 15 -> withdrawal complete
5, 16 -> webhook sent
11 -> order placement initiated
12 -> purchasing crypto
14 -> withdrawal initiated
chainId -> denotes which chain the coin was sent on (e.g. 3 denotes MATIC20)
onRampFee -> fee charged by onramp in pct
clientFee -> fee charged by client
gatewayFee -> fee charged by gateway
gasFee -> Onchain transaction fee charged
actualCryptoAmount -> actual amount of crypto bought at the time of swap/trade.
actualPrice -> actual price at time of swap/trade.
transactionHash -> hash id of the transaction sent/received onchain.
referenceId -> Reference Id entered by the user after completing fiat payment.
kycNeeded -> KYC status of the user
0 -> basic KYC, no additional information required
1 -> KYC needed to process this transaction
Offramp Explanation (additional fields)
expectedQuantity -> quantity of cryptocurrency that is expected to be received
actualQuantity -> The quantity of cryptocurrency that is actually received post block confirmations.
actualFiatAmount -> The fiat amount that is sent to the user's bank account post conversion of crypto to fiat.
tdsFee -> 1% fee charged in compliance with the Indian tax law.
paymentType -> the method of payout done in fiat
1 -> UPI
2 -> IMPS
status -> denotes the status of the order
-4 -> amount mismatch
-2 -> transaction abandoned.
-1 -> transaction time out.
0 -> order created.
1 -> order confirmed i.e. hash generated.
2,10,11 -> hash found status.
3 -> over limit (If the user sends a quantity of cryptocurrency that exceeds their KYC limit, their funds will be withheld until reviewed manually).
4,12 -> crypto sold.
5,13,30,31,32,33,34,35,36 -> fiat withdrawal initiated to bank
6,14,40 -> fiat withdrawal processed.
7,15,41 -> webhook sent
17 -> provide alternate bank
18 -> processing to alternate bank
19 -> success
Note:
If the
pageSize
parameter is not specified, the default number of records returned will be 50. The maximum number of records that can be retrieved per API call is 500.If webhooks are not enabled, transactions that complete successfully will be assigned a status code of either 4 or 15.
Last updated