Validate Transaction
Last updated
import crypto from 'crypto';
import axios from 'axios';
const apiKey = 'your-api-key';
const apiSecret = 'your-api-secret';
const queryParams = {
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
transactionId: '2144884'
};
const rawPayload = JSON.stringify(queryParams);
const signature = crypto.createHmac('sha256', apiSecret).update(rawPayload).digest('hex');
const headers = {
'x-tlp-apikey': apiKey,
'x-tlp-signature': signature
};
const queryString = new URLSearchParams(queryParams).toString();
axios.get(`https://api.tylt.money/whitelabel/transactions/validate?${queryString}`, { headers })
.then(response => console.log(response.data))
.catch(error => console.error('Error:', error.response ? error.response.data : error.message));{
"status": "success",
"data": {
"isValid": true
},
"msg": ""
}