Versions Compared


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


Image Added

Image Added

Image Added

Getting started with the 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 (this is what is special:)

  3. USSD Payment

  4. Payment by Phone Number

How to Implement

1. Adding the iOS SDK to your project via CocoaPods


Monnify iOS SDK is available through [CocoaPods]( To install it, simply add the following line to your Podfile:

Code Block


pod 'MonnifyiOSSDK'

2. Access an instance of the Monnify SDK

Code Block



let monnify = Monnify.shared

3. Set your merchant API key and contract code.

This should be done in your




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](

Remember to switch to when generating live builds for your application on production.

Code Block


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:

Code Block


let amount = Decimal(100)
let paymentRef = "ASDF123454321"

let parameter = TransactionParameters(amount: amount,
                                      currencyCode: "NGN",
                                      paymentReference: paymentRef,
                                      customerEmail: "",
                                      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.

The initializePayment() method requires the following:

    * A ViewController instance.    

    * An instance of TransactionParameters, e.g `parameter` above.

    * A completion/callback to be called with the monnify SDK is completing either after a failure or success.


Code Block



monnify.initializePayment(withTransactionParameters: parameter,
                          presentingViewController: self,
                          onTransactionSuccessful: { result in
    print(" Result \(result) ")

6. Get the outcome of the payment attempt.

The result is available via the callback registered in


`initializePayment()` as described above.

For example, you can access the transaction status from the result as shown below.

Code Block


let transactionStatus = result.transactionStatus

Other information in the result includes transaction reference, payment reference, payment method, and the amount paid.

Transaction Status Possible Values!

Possible values for transaction status enum returned from the SDK and their meanings below:




No payment has been made on this transaction.


Payment has been completed on this transaction.


Customer overpaid on this transaction and Merchant has configured that overpayment is accepted. This is only possible for account transfer payment method.


Customer underpaid on this transaction and Merchant has configured that underpayment is accepted. This is only possible for account transfer payment method.


Payment has been made on this transaction but it cannot be accepted because of the merchant configuration or because of some other reasons. This is only possible for account transfer payment method.


No payment was made before the allowed time elapsed. Hence transaction has expired and no payment can be made on this transaction.


User cancelled and closed the SDK before payment was made.


The transaction ended with a failure. This can happen if a transaction has expired or if an incorrect amount was paid and the merchant configured that only the exact amount should be accepted

Please reach out to the support team for any clarification. 

Payment Method Possible Values!




The Payment method used for payment on this transaction is Card.


The payment method used for payment on this transaction is Account Transfer.


The payment method used for payment on this transaction is USSD code.


The payment method used for payment on this transaction is the phone number linked to your bank account.