How to integrate Mozambique Mpesa API from (Vodafone Mpesa API Mozambique)

Integrating Mozambique Mpesa API, a service offered by Vodafone in Mozambique is very easy when you understand what you need to do and what you get as results on each step.

Environment.

The environment you are integrating Mpesa for Mozambique API can either be:

a). Live or api.

b). Sandbox or api.sandbox.

Your will most probably write your Mpesa Integration code in sandbox, test it fully and move to Live and be assured everything works perfectly without having to change anything in your API integration code except the credentials, host, port and the environment.

HOST

 For Mozambican Mpesa API integration, the host is either:

a). api.sandbox.vm.co.mz (for sandbox environment)

b). api.vm.co.mz for live environment.

DEVELOPER CREDENTIALS

To integrate Mpesa Mozambique, you need developer credentials which you get from https://developer.mpesa.vm.co.mz. Create an account and get sandbox as well as live credentials as follows:

a). MPESA PUBLIC KEY

b). MPESA API KEY

c). MPESA ORIGIN (Cross-Origin Resource Sharing (CORS) which is developer.mpesa.vm.co.mz

d). MPESA SERVICE PROVIDER CODE - apply this at an Mpesa shop in Mozambique.

d). MPESA INITIATOR IDENTIFIER

e) MPESA SECURITY CREDENTIAL

These, together with the environment and host, you are ready to write your API integration code in whichever language you would like your Integration to be written in. To get sample code to write your Mpesa API Integration code, look into this link when logged in https://developer.mpesa.vm.co.mz/apis/3/1/#header and you see sample header and request body. Right now, the API resource link above provides sample code in Java and Python, but any experienced programmer will write in any language.

To be sure you are writing the correct code for the correct purpose, you need to know your business logic and what you want to do using the Mpesa API.

On this link https://developer.mpesa.vm.co.mz/apis/, you find the different APIs allowed by Mpesa Mozambique Vodacome company. They are as follows:

1). Query Transaction Status - This is the API you send your code to when trying to get the status of a certain transaction.

2). Reversal - Send your request body here when trying to refund a certain transaction.

3). C2B - This is the api which your customers will use to make payments to your business.

4). B2B - This is the API you want to call when transferring funds from one SERVICE PROVIDER CODE to another.

5). B2C - Your code should use this API when you want your business to pay individual Mpesa numbers like in case of promotion payments, Betting withdrawals, Salary payments etc.

To make it clear, the above developer credentials are best understood as below:

a) Sandbox developer credentials are for testing purposes only to ensure your code is well written and that your application logic is working well. Find sandbox developer credentials on: https://developer.mpesa.vm.co.mz/ipg/profile/

b). Live or production developer credentials are provided by Vodafone at their Mpesa shop in Mozambique (not Mpesa agent). You can also contact them here: https://developer.mpesa.vm.co.mz/ipg/contactus/ to request for these Production developer credentials.

The requirements:

To integrate Mozambique Mpesa API on sandbox is not a big hustle and you can do it anytime with or without a business in Mozambique. However, during during the time you want to move live, there are some things you need to have:

a). A business or company registered in Mozambique with a valid registration business or company certificate.

b). Taxpayer number (NUIT) and certificate.

c). The Bilhete de identidade (English: Identity Card), commonly abbreviated to BI of the business owner or partners or company directors.

d). Bank account for your business or company where settlements will be send to after collection.

e). A report of successful test transactions found on: https://developer.mpesa.vm.co.mz/reports/

Note: For company and partnership, more documents are needed which varies from time to time. Visit a Vodacom Mpesa shop within Mozambique major towns to inquire or send them an email.

Finally, GOING LIVE

 Hit the GO live button in your developer portal account and submit the form as requested. Vodacom will review the request together with your successful transactions report and approve or reject your live credentials request.