Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
themeMidnight
titleMonnify Web SDK
<script type="text/javascript" src="https://sdk.monnify.com/plugin/monnify.js"></script>
<button onclick="payWithMonnify()">Pay with Monnify</button>
			

<script type="text/javascript">
	function payWithMonnify() {
		MonnifySDK.initialize({
			amount: 5000,
			currency: "NGN",
			reference: '' + Math.floor((Math.random() * 1000000000) + 1),
			customerName: "John Doe",
			customerEmail: "monnify@monnify.com",
			customerMobileNumber: "08121281921",
			apiKey: "MK_TEST_SAF7HR5F3F",
			contractCode: "4934121693",
			paymentDescription: "Test Pay",
			isTestMode: true,
		    metadata: {
                    "name": "Damilare",
                    "age": 45
            },
			paymentMethods: ["CARD", "ACCOUNT_TRANSFER"],
			incomeSplitConfig: 	[
            	{
	    			"subAccountCode": "MFY_SUB_342113621921",
	    			"feePercentage": 50,
		    		"splitAmount": 1900,
		    		"feeBearer": true
    			},
    			{
		    		"subAccountCode": "MFY_SUB_342113621922",
		    		"feePercentage": 50,
	    			"splitAmount": 2100,
	    			"feeBearer": true
	    		}
    	    ],
			onComplete: function(response){
				//Implement what happens when transaction is completed.
	 			console.log(response);
			},
			onClose: function(data){
				//Implement what should happen when the modal is closed here
				console.log(data);
			}
		});
	}
</script>

...

FieldDescription
amount (M)The amount to be paid by the customer
currency (M)The currency of the transaction being initialized. "NGN"
reference (M)Merchant's Unique reference for every transaction. (The SDK already has a code snippet that generates this for you, but you can always replace it)
customerName (M)Full name of the customer
customerEmail (M)Email address of the customer
customerMobileNumber (M)Phone number of the customer
apiKey (M)Merchant's API Key (Can be found on the Monnify dashboard)
contractCode (M)Merchant's contract code (Can be found on the Monnify dashboard)
paymentDescription (M)Description for the transaction. Will be used as the account name for bank transfer payments
isTestMode (M)Should be set to true when using the sandbox and false when on production
transactionHash (M)Transaction Hash added to transaction response for security purposes. Click here for information on how to calculate the hash value
paymentStatus (M)Status of the transaction ("PAID", "PENDING" or "FAILED")
incomeSplitConfig Object containing specifications on how payments to this reserve account should be split.
subAccountCode (m)The unique reference for the sub account that should receive the split.
feeBearerBoolean to determine if the sub account should bear transaction fees or not
feePercentageThe percentage of the transaction fee to be borne by the sub account
splitPercentageThe percentage of the amount paid to be split into the sub account.
paymentMethodsAn array containing payment methods which will be displayed to select from. It's defaulted to both account and card payment methods.

...