reactjs-moamalat
v1.1.7
Published
The moamalat package is a ReactJS plugin that simplifies the process of integrating Moamalat for the payment integration.
Downloads
23
Readme
Moamalat Documentation
Installation
To install the Moamalat package, use the following npm command:
npm install reactjs-moamalat
Usage
To use Moamalat in your ReactJS project, follow these steps:
- Import the Moamalat component into your React component:
import Moamalat from 'reactjs-moamalat';
- Use the Moamalat component in your render method:
<Moamalat
amount={100.5}
TID={123456}
MID={7890}
transactionReference="ABC123"
secretKey={54321}
dateTime={1625278085000}
errorCallback={handleCallBack}
completePaymentCallback={completePaymentCallback}
errorPaymentCallback={errorPaymentCallback}
cancelPaymentCallback={cancelPaymentCallback}
env={'staging'}
payButtonStyle={payButtonStyle}
/>
const payButtonStyle = {
color: '#000000',
backgroundColor: '#CCCCCC',
borderRadius: '10px'
};
In the above code snippet, you can customize the props according to your requirements. The available props for the Moamalat component are:
amount
(number, required): The amount for the transaction. It can be a float or an integer.TID
(number, required): The terminal ID for the transaction.MID
(number, required): The merchant ID for the transaction.transactionReference
(string, optional): The transaction reference for the transaction. It can be alphanumeric.secretKey
(number, required): The secret key for the transaction.dateTime
(number, optional): The date and time of the transaction. It should be in numeric format.env
(string, required): Application environment either 'staging' or 'prod'.payButtonStyle
(object, optional): This will accept an object having the custom styles to be implemented on the pay button.errorCallback
(function): This callback will return errors if exists in props. Each error object will contain status and message.completePaymentCallback
(function): This callback will return the success status and message and, the data after the successful payment.errorPaymentCallback
(function): This callback will return the error status and message and, the data after the failure payment.cancelPaymentCallback
(function): This callback will return cancelled status and message.
API Reference
The Moamalat component accepts the following props:
amount
(number, required): The amount for the transaction. It can be a float or an integer.TID
(number, required): The terminal ID for the transaction.MID
(number, required): The merchant ID for the transaction.transactionReference
(string, optional): The transaction reference for the transaction. It can be alphanumeric.secretKey
(number, required): The secret key for the transaction.dateTime
(number, optional): The date and time of the transaction. It should be in numeric format.env
(string, required): Application environment either 'staging' or 'prod'.
Version History
- 1.0.0 (current version)
- Initial release of Moamalat package.
Support
For documentation, FAQs, and support, please visit the Moamalat GitHub repository.
License
Moamalat is released under the MIT License.