Authorization
API Authentication
Code Example
require("isomorphic-fetch");
const crypto = require("crypto");
async function sendRequest() {
const apiKey = "YOUR_API_KEY";
const apiSecret = "YOUR_API_SECRET";
const path = "/payment/v1/requestPaymentAddress";
const nonce = Date.now().toString();
const httpMethod = "POST";
const signatureContent = JSON.stringify({
httpMethod,
path,
nonce,
});
const sig = crypto
.createHmac("sha384", apiSecret)
.update(signatureContent)
.digest("hex");
try {
const res = await fetch(`https://api-staging.aquanow.io${path}`, {
method: httpMethod,
headers: {
"x-nonce": nonce,
"x-api-key": apiKey,
"x-signature": sig,
},
body: JSON.stringify({
cryptoType: "BTC",
fiat: "CAD",
fiatReceivable: 5,
subaccount: "YOUR_CUSTOM_PAYMENT_ID",
}),
});
if (res.status !== 200) {
throw new Error(`${(await res.json()).message} status ${res.status}`);
}
const result = await res.json();
console.log("Result: ", result);
} catch (error) {
console.log("error", error);
}
}
sendRequest();Common Auth Errors
401
403
Last updated
Was this helpful?
