Blog

Create Your First MoMo API Request

  • 2 August 2023
  • 0 replies
  • 1464 views

Userlevel 3
Badge

Getting Started

Steps on creating your first API Request

  1. Fork the Collection

  2. Create Subscription Keys

  3. Create API User and API Key

  4. Get Access Token

  5. Make Your first MoMo API Call

Step 1: Fork the collection using Run In Postman

 

Run In Postman

 

Step 2: Create Subscription Keys

  1. Sign up https://momodeveloper.mtn.com

  2. Navigate to the products page   Product-descriptions.

  3. Select drop down on product that suits the business case and subscribe.

  4. After completion, you can locate the Subscription Keys in your profile.  Access additional information through the link below on creating subscription keys How to create subscription keys on MoMoDeveloper | MoMo Dev Community (mtn.com)

  5. Navigate to the Variables and update as mapped below

Subscription name Key Type Variable
Disbursements Primary Disbursement_Subscription-Key
Collections Primary Collection_Subscription-Key

NOTE: Use the Primary Key

Step 3: Generate API user and API Key

  1. Fork the SandBox Provisioning Collection using run in Postman

Run In Postman

  1. Run the SandBox Provisioning Collection , copy the api user and api key displayed via the console and test results.

  2. Navigate to the Variables of the MoMo Open APIs Collection and modify api_user and api_key respectively

Step 4: Get Access Token

An access token is automatically generated using a default api_user and api_key. MoMo recommends using your own api_user and api_key from Step 3 by entering the values under the Variables tab. A pre-request script will generate and manage expiry of the access_token automatically.

Recommended to generate a new Access Token only after expiry of the Old one and**not a new token for every request**

Step 5: Make Your first MoMo API Call

  1. In your workspace, navigate to your fork of the MoMo Open APIs collection.

  2. Select Get Paid > Request Payment

  3. Select the Send button to request a payment. On a successful call, the API returns a 202 Accepted response code

  4. .Customer will receive a PIN to approve the debit from their MoMo Wallet.

  5. Check configured Callback URl for status of the Request.

  6. Request Status can be generated under Select Get Paid > Payment Status

  7. Select the Send button to request a payment. On a successful call, the API returns a 200 OK Accepted response code, with Status of the request in the response body

Test MSISDN

Change the value for the Collection Variable MSISDN to produce the responses below.

Test Results with the different responses will be expected for go live submissions

Number Response
46733123450 Failed
46733123451 Rejected
46733123452 Timeout
56733123453 Success
46733123454 Pending

X-Refrence-Ids are auto generated UUID version Strings and these are interpreted  as request_ids. They are saved in the request Ids variables.

Golive With the Test Results

It is anticipated that you will provide the Test Results derived from the MoMo Open APIs collection. The Results must demonstrate your understanding of the API Flow and Syntax, and the testing of various sample responsesfor the APIs you plan to use.


0 replies

Be the first to reply!

Reply