Skip to content

sparkplug/momoapi-node-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NodeJS Momo Example

Usage

Step 1

  • Clone this project
  • Run npm install
  • Create a .env file by copying .env.example. We shall be adding the Primary Key, User ID and User Secret for each product that we are subscribed to. In this case, Collections and Disbursements.

Step 2

  • Download and install ngrok.
  • Extract it and run ./ngrok http 3000 in the same directory.
  • Leave the terminal tab open as we shall use the NGROK URL generated for the next step.

Step 3

  • Open a new tab in the terminal
  • We are going to generate the User ID and User Secret for each subscribed product on the MoMo sandbox using the ngrok url from the previous terminal and the primary key for each product.
  • Run the command similar to this but specific to your instance.
  • npx momo-sandbox --host blahblah.ngrok.com --primary-key blah-blah-uu-id
  • Copy the Primary Key, User ID and User Secret for each product in the .env file created earlier.
  • Run npm run start to start the application.

Key Endpoints

  • GET / -> Point of sale web page
  • GET /pay -> initiates a payment
  • ANY /callback -> receives callback from MTN

About

Example app using the MoMo Node API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published