Monnify allows you to receive payments from your customers via bank transfers, debit cards, USSD, and through the use of their phone numbers. Every time a transaction is initiated, the Monnify SDK displays a distinct account number, which your customers can pay into by using any of the available Monnify payment methods.
The checkout feature allows you to integrate a checkout functionality into your websites to enable your customers make payments on your platform. The Monnify Checkout Page provides customers with various payment method options such as;
Installing the Monnify Checkout Page is very easy and can be done by adding the checkout Javascript snippet to your website by copying the snippet code as shown below:
<html><head><scripttype="text/javascript"src="https://sdk.monnify.com/plugin/monnify.js"></script><script>function payWithMonnify() {MonnifySDK.initialize({amount: 100,currency: "NGN",reference: new String(new Date().getTime()),customerFullName: "Damilare Ogunnaike",apiKey: "MK_PROD_FLX4P92EDF",contractCode: "626609763141",paymentDescription: "Lahray World",metadata: {name: "Damilare",age: 45,},incomeSplitConfig: [{subAccountCode: "MFY_SUB_342113621921",feePercentage: 50,splitAmount: 1900,feeBearer: true,},{subAccountCode: "MFY_SUB_342113621922",feePercentage: 50,splitAmount: 2100,feeBearer: true,},],onLoadStart: () => {console.log("loading has started")},onLoadComplete: () => {console.log("SDK is UP")},onComplete: function (response) {//Implement what happens when the transaction is completed.console.log(response)},onClose: function (data) {//Implement what should happen when the modal is closed hereconsole.log(data)},})}</script></head><body><div><button type="button" onclick="payWithMonnify()">Pay With Monnify</button></div></body></html>
When the transaction is completed, Monnify will return a response object to your onComplete function.
{"amount": 100,"amountPaid": 100,"completed": true,"completedOn": "2022-03-31T10:53:50.000+0000","createdOn": "2022-03-31T10:52:09.000+0000","currencyCode": "NGN","customerName": "Damilare Ogunnaike","fee": 10.75,"metaData": {"deviceType": "mobile","ipAddress": "127.0.0.1"},"payableAmount": 100,"paymentMethod": "CARD","paymentReference": "MNFY|PAYREF|GENERATED|1648723909057299503","paymentStatus": "PAID","transactionReference": "MNFY|67|20220331115209|000063"}
It is recommended that you always make a get transaction status call whenever a transaction is completed (or canceled) before saving the transaction on your database. Monnify will also notify you via your webhook URL of the status of any transaction.
If a user cancels, Monnify returns the following response to your onClose function
{"authorizedAmount": 30,"paymentStatus": "USER_CANCELLED","redirectUrl": null,"responseCode": "USER_CANCELLED","responseMessage": "User cancelled Transaction"}
Note: By default, all payment methods are displayed. However, if you want to control the displayed payment methods, you can do so by setting paymentMethods field in the initialization request as seen below:
...paymentMethods: ["CARD","ACCOUNT_TRANSFER","USSD","PHONE_NUMBER"],onLoadStart: () => {console.log("loading has started");},
If the paymentMethods property isn’t included, by default, all the available payment methods will be displayed to your customers. If the paymentMethods property is specified, the listed payment methods will be displayed to your customers, see the sample below:
The Monnify Android SDK allows you to accept payments from customers in your Android application via:
The Monnify Flutter SDK allows you to accept payments from customers in your Mobile application via:
Add monnify_payment_sdk as a dependency in your pubspec.yaml file.
Initialize the plugin. This should be done once, preferably in the "initState" of your widget.
import 'package:monnify_payment_sdk/monnify_payment_sdk.dart';class _MyAppState extends State<MyApp> {@overridevoid initState() {super.initState();MonnifyPaymentSdk.initialize('YOUR_API_KEY','CONTRACTCODE',ApplicationMode.TEST)}}
Create an object of the Transaction class and pass it to the initializePayment function.
Future<void> initPayment() async {TransactionResponse transactionResponse =await MonnifyPaymentSdk.initializePayment(Transaction(2000,"NGN","Customer Name","PAYMENT_REF","Description of payment",metaData: {"ip": "196.168.45.22","device": "mobile_flutter"// any other info},paymentMethods: [PaymentMethod.CARD, PaymentMethod.ACCOUNT_TRANSFER],incomeSplitConfig: [SubAccountDetails("MFY_SUB_319452883968", 10.5, 500, true),SubAccountDetails("MFY_SUB_259811283666", 10.5, 1000, false)]));}
First off, the Monnify iOS SDK allows you to accept payments from customers in your iOS application via:
let amount = Decimal(100)let paymentRef = "ASDF123454321"let parameter = TransactionParameters(amount: amount,currencyCode: "NGN",paymentReference: paymentRef,customerName: "John Doe" ,customerMobileNumber: "08000000000",paymentDescription: "Payment Description.",incomeSplitConfig: [],metaData: ["deviceType":"ios", "userId":"user314285714"],paymentMethods: [PaymentMethod.card, PaymentMethod.accountTransfer],tokeniseCard: false)
let amount = Decimal(100)let paymentRef = "ASDF123454321"let parameter = TransactionParameters(amount: amount,currencyCode: "NGN",paymentReference: paymentRef,customerName: "John Doe" ,customerMobileNumber: "08000000000",paymentDescription: "Payment Description.",incomeSplitConfig: [],metaData: ["deviceType":"ios", "userId":"user314285714"],paymentMethods: [PaymentMethod.card, PaymentMethod.accountTransfer],tokeniseCard: false)
If (for some reason) you don't want to use the an SDK, you can call the Checkout APIs directly.
Monnify allows merchants to create a seamless payment interface tailored to their users, enabling them to design their own checkout page for full control over the payment experience. The APIs below can help you achieve this.
transactionReference
of an initialized transaction. You will receive the virtual account your customer can make payments to. If a bankCode
is specified, the response will also include a unique USSD code for that bank, enabling your customer to make a USSD payment for the transaction.ussdPayment
. Please make sure to inform your customers of the expiry time of the virtual accounts, to prevent rejected or erroneous transactions.transactionReference
of an initialized transaction. Test card details are provided in the API reference.Error Message | Meaning | Action |
---|---|---|
Unknown currency code supplied | This means that the currencyCode supplied in the payload is not part of Monnify supported currencies | Retry with a currency code supported by Monnify |
Could not find specified contract | This means that the contractCode in the request payload is either invalid or doesn’t belong to the merchant. | Retry with a valid contractCode that belongs to the merchant and matches the integration environment |
Duplicate payment reference | This implies that the payment reference used in the request payload has been previously used in the same environment by the merchant | Ensure that the payment reference is unique for each transaction initialization |
Invalid Card Number | This implies that the card PAN supplied is wrong | Check that the card PAN supplied is correct and try again |
Merchant has not been configured for bin | This implies that the first six digits of the customer's card PAN is not among our supported card bins | Customer should confirm that the card is a Nigerian card, otherwise contact Monnify support |
Could not find transaction with the specified transaction reference | This implies that the supplied transaction reference does not exist for merchant | Reconfirm the transaction reference and retry |