m-naira App is also a mobile payment gateway payment solution for online businesses with website and mobile apps. Integration to m-naira App allows your customers to pay via m-naira online with just their m-naira app without fear of their ATM card or bank account.

Integration requirements

  1. Send email proposal requesting integration to accept m-naira as the payment option on your online business or website with details such as (Phone number, email address, bank name, bank account, and your address) for a merchant account to be open for your business
  2. Also, send your callback_url – the URL of your website page which handles transaction result.
  3. Our Support team will respond to your email with your merchant username your and api_key for the integrations
  4. Send your email to support@mnaira.app
  5. Acceptance of NGN 79.99 convenience fee per transaction

m-naira online payment API Integration overview

1.       Making payment via m-naira platform online

A merchant can choose one of two options for accepting payments on the website from m-naira App users:

  1. server to server API
  2. client request from the web page

Regardless of the method, the merchant can define callback_url which will send information about the transaction result.

2.1 Server to server API

create_pay
var response = await rp.get({uri:'https://api.mnaira.app/merchant/create_pay/',qs:
{
                username:"2348060031658",
                api_key:"2ewfregrt5",
                description:"Oyi-1 Smartphone",
                amount:"NGN 2,500"
        }})

In this implementation, the merchant takes care of order processing between the client browser and the backend server. On completing the order, the server has to make a call to the create_pay api. The call initiates a new transaction. The parameters are:

  • amount – price of the sold item
  • description – short text description of the item, it will appear on the customer’s bill in m-naira app.
  • api_key and username are provided by m-naira Support Team

In response the api sends a json object of the following structure:

{
       status:1,
        data:{
         id_transaction:’mnobsuxhaosyeopa’,
         url:"https://api.mnaira.app:8080/app?id_transaction=mnobsuxhaosyeopa
         }   
}

Status 1 indicates that transaction was initiated, is now in “pending” state and got assigned an id_transaction. The merchant server should use the url passed in the object to send it to client browser and open it there. Once this URL is opened in client browser two situations may follow:

  1. If there is m-naira app installed the app opens and shows the amount and description. If the user has enough balance on the account, he can complete the payment with just one click. If there is no money on his account the app will show the Top-up view prefilled with the amount and description fields and the user can pay using one of the offered options – ATM card, bank transfer, and others.
  2. If there is no m-naira app installed on the user’s phone the browser will be redirected to the google play or app store URL with an additional parameter containing the id_transaction. When the user clicks on the install button the app will be installed and once the user signs up the app will show him or her the Top-up screen with the transaction details – description and amount. He can now easily top-up his account and automatically complete the payment to the merchant.

2.2 Sending request from a web page

Merchant can also add a payment form directly on his web site where a customer chooses an item and then both item’s description and item’s amount are send using a simple GET request to the m-naira payment API. The example form can look as below:

<!doctype html>
<html>
  <head>
    <title>Store</title> 
  </head>
  <script src="https://code.jquery.com/jquery-1.11.1.js"></script>
  <script src="https://api.mnaira.app:8080/client.js"></script>
  <body>
    <form>
    <input type="button" value ="Pay with M-Naira" onclick="getIdTrans()"/>
    <input id = "username" value = "2348060031658" hidden = true/>
    <input id = "description" value = "Flowers"/>
    <input id = "amount" value = "100"/>
  </form>
  </body>
</html>
  • username – this is the username given to the merchant by m-naira support Team
  • description – text about the item to sell
  • amount – the price of the item

On submitting the form, the m-naira payment API initiates a transaction with new id_transaction and open a new URL in the client browser which, same as in paragraph 2.1, opens the m-naira app if already installed on the user’s device or redirects to the Google play otherwise. Please see the description of those scenarios in the previous paragraph 2.1.

Callback URL request and “verify” api are eligible for this payment flow as well as for the server to server flow.

c.     Callback url call

Once the payment to a merchant is made the m-naira API will send a GET request to the callback URL provided by the merchant on setting up the merchant account.

Following parameters are sent in the request, the values are an example, they will differ for each transaction:

id_transaction =” zeqizayepinopageyuha”
status = "failure",
                error =” error text”,
                payer = account_.username,
                amount = 100,
                description = “pizza margherita”

For successful transaction the status is “success”, also the error parameter is omitted.

d.    Verify transaction

This m-naira payment api should be called by the merchant on receiving the call to callback url with status 1 which means that the transaction was completed. To have an additional safety check the m-naira API providers “verify” api. In the request the merchant should send the id_transaction received in the call to callback url.  Below is an example request:

  var response = await rp.get({uri:'https://api.mnaira.app/merchant/verify/',qs:{
  1. username:"2348600316058",
  2. api_key:"2ewfregrt5",
  3. id_transaction:"zeqizayepinopageyuha"
  4. }})

If the transaction is valid and is in “completed” state, the response will contain a json object of the following structure:

       {status:1,
        data: {
            payer:”234860349553”,
            amount:NGN2,500,
            id_transaction:”wefepinfsogeyuha”,
           description:”pizza Quadro fromage”
        },
        message:"completed"
        }

If the transaction is not completed the response will have status 0 and the message will show the current state for example “pending” or “failed”

3 Making a payment from a PC

On a merchant web page, a customer clicks on “Pay with M-Naira” button. In the next step, the page loads the QR code and the Pay with the BLINK input field.

Customer can choose whichever option he prefers:

QRCode – a customer has to open his MNaira app on a smartphone, click Pay with Naira and scan the code from his computer screen. After that, transaction details appear on M-Naira. The customer confirms payment and the transaction is completed. At the same moment, the amount is sent to the merchant.

BlINK – customer opens M-Naira app and clicks the “BLINK” button. Code valid for 100 seconds is presented. The customer enters this code on the web page on his computer and clicks Pay with Blink. In an instant, he gets transaction details shown on M-Naira. Customer clicks Confirm button to complete the transaction. The amount is sent to the merchant.

In either of the options if there is no balance on customer’s wallet the M-Naira app will redirect him to the top up screen where he can pay using a payment provider eligible for his location.

Example of the code on the web page:

!doctype html>
<html>
  <head>
    <title>Store</title> 
  </head>
  <script src="https://code.jquery.com/jquery-1.11.1.js"></script>
  <script src="https://api.mnaira.app:8080/client_PC.js"></script>
  <body>
    <form>
    <input type="button" value ="Pay with M-Naira" onclick="getIdTrans()"/>
    <input id = "username" value = "486045568" hidden = true/>
    <input id = "description" value = "Flowers" readonly/>
    <input id = "amount" value = "100" readonly/>
  </form>
  <div>
    <label id = "qr_lab" hidden=true>Use Mnaira app and scan the QR picture</label>
    <br>
    <img src = "" id = "qr" />
    <br>
    <br>
    <label id="blink_lab" hidden=true>Or open M-Naira app, click on BLINK and then enter the BLINK code here </label>
    <input id="blink_code" value = "" hidden=true />
    <input type="button" id="blink_btn" value ="Pay with BLINK" hidden=true onclick="blinkfunc()"/>
    <input id="id_transaction" value = "" hidden=true />
  </div>
  </body>
</html>