Set/Update Webhook URL
POST
https://api.onramp.money/onramp/api/v1/merchant/setWebhookUrl
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 |
---|---|---|
webhookUrl* | String | Your webhook url |
{
status: 1,
code: 200,
data: 'Webhook url set to https://yourWebhookUrl.com'
}
Sample Request
var CryptoJS = require('crypto-js');
var axios = require('axios');
async function main() {
try {
let body = {
webhookUrl: 'https://yourWebhookUrl.com'
}
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/merchant/setWebhookUrl',
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)
}
}
main();
import json
import time
import base64
import hmac
import hashlib
import requests
def set_webhook_url():
try:
body = {
'webhookUrl': 'https://yourWebhookUrl.com'
}
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/merchant/setWebhookUrl'
response = requests.post(url, headers=headers, data=json.dumps(body))
print(response.json())
except Exception as e:
print(str(e))
set_webhook_url()
{
status: 1,
code: 200,
data: 'Webhook url set to https://yourWebhookUrl.com'
}
status -> 0 is for unsuccessful request, 1 is for a successful one
code -> Provides more specific information about the status of the webhook update request. Below are some possible values and their meanings:
200 -> Webhook was successfully updated.
400 -> A required parameter is missing in the request.
500 -> Onramp.money servers are currently down; please try again later
Last updated