{
"endUserId": 20001, // Optional: Provide one user identifier only
"endUserEmail": "joe@example.com", // Optional: Alternative to endUserId and externalUserId
"externalUserId": "user-10021", // Optional: Alternative to endUserId and endUserEmail
"toExternalUserId": "recipient-user-10045",
"settledAmount": "10",
"settledCurrency": "USDT",
"comments": "Payment for order 4501",
"timestamp": 1700000000000,
"nonce": "ecb0272c-637e-4778-b4d4-55e6eed21017",
"emailCode": "123456",// OTP returned through the transaction email OTP flow
"googleAuthCode": "654321"// TOTP generated by the end user's authenticator application
}
import crypto from 'crypto';
import axios from 'axios';
const apiKey = 'your-api-key';
const apiSecret = 'your-api-secret';
const requestBody = {
endUserId: 20001, // Optional: Provide one user identifier only
endUserEmail: "joe@example.com", // Optional: Alternative to endUserId and externalUserId
externalUserId: "user-10021", // Optional: Alternative to endUserId and endUserEmail
toExternalUserId: 'recipient-999', // Recipient's external ID (mapped server-side to UUID)
settledAmount: '5',
settledCurrency: 'USDT',
comments: 'Internal Transfer Payment',
emailCode: "106856",// OTP returned through the transaction email OTP flow
googleAuthCode: "502094",// TOTP generated by the end user's authenticator application
timestamp: Date.now(),
nonce: crypto.randomBytes(8).toString('hex')
};
const raw = JSON.stringify(requestBody);
const signature = crypto.createHmac('sha256', apiSecret).update(raw).digest('hex');
const headers = {
'x-tlp-apikey': apiKey,
'x-tlp-signature': signature,
'Content-Type': 'application/json'
};
axios.post('https://api.tylt.money/whitelabel/wallet/internalTransfer', raw, { headers })
.then(response => console.log(response.data))
.catch(error => console.error('Error:', error.response ? error.response.data : error.message));