One Time Payment

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.

Monnify Checkout

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;

  1. Pay with Bank Transfer: This payment method allows your customers to make a payment to a dynamically generated account number for the transaction.
  2. Pay with USSD: This payment method allows your customers to make a payment using USSD.
  3. Pay with Card: This payment method allows your customers to make payments using their card.
  4. Pay with Phone Number: This payment method allows your customers to make a payment using a phone number to initialize a session.


Adding Monnify Checkout to your Website

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
Copy button
<html>
<head>
<script type="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",
customerEmail: "[email protected]",
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 here
console.log(data);
}
});
}
</script>
</head>
<body>
<div>
<button type="button" onclick="payWithMonnify()">Pay With Monnify</button>
</div>
</body>
</html>

Response Object

When the transaction is completed, Monnify will return a response object to your onComplete function.

json
Copy button
{
"amount": 100,
"amountPaid": 100,
"completed": true,
"completedOn": "2022-03-31T10:53:50.000+0000",
"createdOn": "2022-03-31T10:52:09.000+0000",
"currencyCode": "NGN",
"customerEmail": "[email protected]",
"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.


User Cancelled Response

If a user cancels, Monnify returns the following response to your onClose function


json
Copy button
{
"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:


json
Copy button
...
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:


json
Copy button
...
paymentMethods: [
"USSD",
"PHONE_NUMBER"
],
onComplete: function(response) {
console.log(response);
},


Monnify Android SDK

The Monnify Android SDK allows you to accept payments from customers in your Android application via:

  1. Card Payment
  2. Bank Transfer
  3. USSD Payment
  4. Payment by Phone Number


Steps to Implementation

1. Add the dependency for the Monnify SDK
To your root build.gradle file add:

json
Copy button
allprojects {
repositories {
google()
mavenCentral()
}
}

To your app-level build.gradle file add:


2. Create an instance of the Monnify SDK

json
Copy button
dependencies {
// ...
implementation "com.monnify.android-sdk:monnify-android-sdk:1.1.7"
}

Monnify Checkout URL

If (for some reason) you don't want to use the web SDK, you can call the Checkout APIs directly.

You can do this by calling the Initialize Transaction API

Monnify iOS SDK

First off, the Monnify iOS SDK allows you to accept payments from customers in your iOS application via:



  1. Card Payment
  2. Bank Transfer
  3. USSD Payment
  4. Payment by Phone Number

How to Implementation

  1. Adding the iOS SDK to your project via CocoaPodsMonnify iOS SDK is available through [CocoaPods](https://cocoapods.org). To install it, simply add the following line to your Podfile:

    json
    Copy button
    pod 'MonnifyiOSSDK'
  2. Access an instance of the Monnify SDK Monnify iOS SDK is available through [CocoaPods](https://cocoapods.org). To install it, simply add the following line to your Podfile:

    json
    Copy button
    let monnify = Monnify.shared
  3. Set your merchant API key and contract code.This should be done in your `AppDelegate.swift` file. This should only be done once in the entire application.
    This can be a TEST or LIVE. The TEST mode works on a sandbox environment and payment can be simulated [here](https://websim.sdk.monnify.com/#/bankingapp).
    Remember to switch to ApplicationMode.live when generating live builds for your application on production.

    json
    Copy button
    let apiKey = "MK_PROD_XXXXXXXX"
    let contractCode = "1234567890"
    let mode = ApplicationMode.test
    monnify.setApplicationMode(applicationMode: mode)
    monnify.setApiKey(apiKey: apiKey)
    monnify.setContractCode(contractCode: contractCode)
  4. Specify the transaction parameters as shown below:

    json
    Copy button
    let amount = Decimal(100)
    let paymentRef = "ASDF123454321"
    let parameter = TransactionParameters(amount: amount,
                                          currencyCode: "NGN",
                                          paymentReference: paymentRef,
                                          customerEmail: "[email protected]",
                                          customerName: "John Doe" ,
                                          customerMobileNumber: "08000000000",
                                          paymentDescription: "Payment Description.",
                                          incomeSplitConfig: [],
    metaData: ["deviceType":"ios", "userId":"user314285714"],
    paymentMethods: [PaymentMethod.card, PaymentMethod.accountTransfer],
                                          tokeniseCard: false)
  5. Launch the payment gateway, perhaps when the user clicks on a 'Pay' button.

    json
    Copy button
    let amount = Decimal(100)
    let paymentRef = "ASDF123454321"
    let parameter = TransactionParameters(amount: amount,
                                          currencyCode: "NGN",
                                          paymentReference: paymentRef,
                                          customerEmail: "[email protected]",
                                          customerName: "John Doe" ,
                                          customerMobileNumber: "08000000000",
                                          paymentDescription: "Payment Description.",
                                          incomeSplitConfig: [],
    metaData: ["deviceType":"ios", "userId":"user314285714"],
    paymentMethods: [PaymentMethod.card, PaymentMethod.accountTransfer],
                                          tokeniseCard: false)

Was this page helpful? Tell us what you think..
Copyright © 2024 Monnify