import CryptoJS from 'crypto-js';
const method = 'POST';
const timestamp = new Date().toISOString();
const clientId = 'YOUR_CLIENT_ID';
const hmacSecret = 'YOUR_HMAC_SECRET';
const apiKey = 'YOUR_API_KEY';
const body = JSON.stringify({
fullName: 'Jane Smith',
email: 'jane.smith@yourcompany.com',
currency: 'USD',
initialFunds: 50.00
});
const bodyHash = CryptoJS.SHA256(body).toString(CryptoJS.enc.Base64);
const dataToSign = `${method}\n${timestamp}\n${clientId}\n${bodyHash}`;
const signature = CryptoJS.HmacSHA256(dataToSign, hmacSecret).toString(CryptoJS.enc.Base64);
const response = await fetch('https://api-partner.orbt.com/api/partner/v1/customer', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': apiKey,
'x-client-id': clientId,
'x-timestamp': timestamp,
'x-body-hash': bodyHash,
'x-signature': signature
},
body
});
JavaScript
A sample code in JavaScript to authenticate your API request:
.png?fit=max&auto=format&n=VbwkqqIyQoTXbpVd&q=85&s=4750dedc4249fbd900c54220786c9522)