Payment Subscription
To receive the payment information when there is the payment transaction, the platform must subscribe to the Payment Support, which must be connected in the SocketIO format according to the link and must subscribe to the event as below:
- url for check the subscription
https://payment-Support.lailaolab.com/?key=<PAYMENT_Support_SECRET>
Request
PARAMETERS
url
stringThe link used to track transactions by viewing the details each time must have a key with the same value as your ScretKey url
<PAYMENT_Support_SECRET>
stringYour ScretKey can be obtained from lailao payment Support portal (opens in a new tab)
EVENTS
join::<PAYMENT_Support_SECRET>
stringYour ScretKey can be obtained from lailao payment Support portal (opens in a new tab)
Code Example
const onSubscribePaymentSupport = (models) => {
try {
const _socketPaymentUrl = "https://payment-Support.lailaolab.com/?key=" + process.env.PAYMENT_Support_SECRET
const socket = io(_socketPaymentUrl);
if (socket.connected) {
console.log('Socket is already connected.');
return; // No need to connect again
}
// Connect to the server
socket.on('connect', () => {
console.log('Connected to the payment Support server!');
// Subscribe to a custom event
socket.on('join::' + process.env.PAYMENT_Support_SECRET, async (data) => {
console.log('Data received:', data);
});
});
// Handle the connection error (optional)
socket.on('connect_error', (error) => {
console.error('Connection failed:', error);
});
return;
} catch (error) {
console.log({ error })
}
}
Response
message
stringThe response message of API call
refNo
stringThe reference number assigned to the transaction
exReferenceNo
stringAn external reference number associated with the transaction
merchantName
stringThe name of the merchant involved in the transaction
memo
stringA brief description of the transaction, e.g., 'PAYMENT'
txnDateTime
stringThe date and time when the transaction was processed, in the format YYYY-MM-DD HH:MM:SS
txnAmount
integerThe amount that was transacted
billNumber
stringA unique bill number associated with the transaction
sourceAccount
stringThe account number from which the funds were sourced
sourceName
stringThe name associated with the source account (may be empty)
sourceCurrency
stringThe currency of transaction
userId
objectA unique identifier for the user who initiated the transaction
status
stringThe current status of the transaction
transactionId
stringA unique identifier for the transaction, not repeat
The Response
{
"message": 'SUCCESS',
"refNo": '001LNMI811581649255',
"exReferenceNo": 'BONEN5JL999C3ZLN',
"merchantName": 'LAILAOLAB ICT SOLUTIONS CO.,LTD',
"memo": 'PAYMENT',
"txnDateTime": '2024-03-28 22:30:50',
"txnAmount": 100000,
"billNumber": 'VobAkGl0gVKrVecIbo2ogYrIk',
"sourceAccount": '1600120000000004810001',
"sourceName": '',
"sourceCurrency": 'LAK',
"userId": new ObjectId("656fd8886b411beab18eca79"),
"status": 'PAYMENT_COMPLETED',
"transactionId": 'VobAkGl0gVKrVecIbo2ogYrIk'
}