Monnet Notifications for SUCCESS and REJECTED Stages
Monnet is pleased to offer an efficient notification system to keep our customers informed about the status of transactions. This feature is essential to ensure smooth and timely communication between Monnet and the Merchant.
We have implemented automatic notifications for the "SUCCESS" and "REJECTED" stages in payouts. These statuses reflect the final outcome of business operations and are vital for transaction tracking and management.
Notification URL Configuration
To enable these automatic notifications, we request your team to provide a valid and secure URL where Monnet can send the notifications. This URL should be prepared to receive and process notification data appropriately. Ensure your technical team is involved in configuring this URL to ensure a successful integration.
To configure the notification URL, please follow these steps:
Contact with our Integration team.
Share the URL designated for the notification.
Our team will configurate the URL internally and let you know.
Notification Composition
Before delving into the specifics of a payout notification, it's essential to understand the composition of the notification itself. Each notification comprises a header and a body. The header includes a field named "verification", which serves as a security signature to check the integrity and authenticity.
Verification Process: The merchantId is required to perform the following steps with the "verification" field:
Get the value of the "verification" field on the header.
Perform the signature verification provided by RSA algorithm using the following inputs:
Content to verify: concatenation of the merchantId and the body of the notification
Signature: verification signature obtained in step 1 using Base64 decoding
Public key extracted from the provided certificate
Notification: Certificate Setup
To ensure notification security, attach the provided notifier certificate in your commerce application's notification settings.
Note: Public key should be extracted from the certificate, this can be done by code or using the openssl tool:
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlwnoASyLECcZwPXBkW2O
IT/L/rzB8xesLC14lt0oH1EnBEufChr0s1c3e/CzeFNwWBXMjsmIlBqYprLJMYg5
v/qijO7FeVvgGqUai7bdi/lZtiTKo6zyLGbK6/K7fw6JiWjcyRxn+oYwMXu7x0HJ
6YUwvU+p9/TEtXIuEpyoUbrk7G2h4N2GgreQh6cHZrmxxjZ3tyRWCDNfxKQtRJtn
UfVvlzgIamHf+XzD4x2SNexYI/E9SZMiCoNoyvOrkujea6ategOUmjGRKAXVExZz
9tomb+4VyFPc/zDPOf7hr5L62r9W201OfVYNrt8AgSyWcn8sexgHf/VlA6ISULYy
LQIDAQAB
-----END PUBLIC KEY-----
Successful Stage Notification
When a transaction is recorded as "SUCCESS," Monnet will also send an automatic notification to the URL address provided by your team. This notification will confirm the positive outcome of the transaction and provide necessary details for your internal record-keeping.
import { createVerify } from 'crypto';
function verifySignature(content, signature, strPk) {
try {
var isVerified = false;
const decodedVerification = Buffer.from(signature, 'base64');
const verifier = createVerify('sha256');
verifier.update(content);
const verificationResult = verifier.verify(strPk, decodedVerification);
if (verificationResult) {
console.log("The notification is authentic");
isVerified = true;
} else {
console.log("The notification is NOT authentic");
}
return verificationResult;
} catch (err) {
console.log("decodeWithPublicKeyBase64 error:" + err);
return;
}
}
Note: In the above example, crypto-js library could perform the signature verification using the certificate directly without extract the public key
Rejected Stages Notification
If the event a transaction is marked as "REJECTED," Monnet will send an automatic notification to the URL address provided by your team. This notification will contain relevant details about the transaction, including rejection reasons and any additional pertinent information. It is crucial for your team to properly configure the notification URL to receive this information promptly.