BUG: onClose method not triggering when I click on close in my next js application
When I try to integrate monnify into my next js application, it does not trigger the onCLose method and it handles the modal close wrongly(it goes to the redirect URL). I have attached a snippet of my implementation
useEffect(() => {
constscript=document.createElement('script');
if (!window.MonnifySDK) {
script.src='https://sdk.monnify.com/plugin/monnify.js';
script.async=true;
document.body.appendChild(script);
console.log('I ran');
}
return () => {
document.body.removeChild(script);
};
}, []);
if (window.MonnifySDK) {
window.MonnifySDK.initialize({
// Your Monnify configuration options
amount:100,
currency: 'NGN',
reference: 'randomId',
customerFullName: `full name`,
customerEmail: 'user@gmail.com',
apiKey: process.env.NEXT_PUBLIC_MONNIFY_API_KEY,
contractCode: process.env.NEXT_PUBLIC_CONTRACT_CODE,
paymentDescription: 'Payment for product',
metadata: {
// extra data
},
paymentMethods: ['ACCOUNT_TRANSFER'],
redirectUrl: 'kreatesell.com',
onLoadStart: () => {
console.log('loading has started!');
},
onLoadComplete: () => {
console.log('SDK is UP and running');
},
onComplete: function (response) {
//Implement what happens when the transaction is completed.
console.log('completed', response);
// onSuccess(response);
},
onClose: function (data) {
//Implement what should happen when the modal is closed here
console.log('closed', data);
},
});
}
0
-
Dear Olatunde Afolayan,
Thank you for contacting Monnify.
We sincerely apologize for the delay.
Please send a mail to integration-support@monnify.com for further assistance. We will be on standby to recieve and treat your request accordingly.
Best regards.0
Please sign in to leave a comment.
Comments
1 comment