API Documentation

mpesa.getAccessToken()

This method is used to get the access token required for making API requests.

mpesa.getAccessToken()
  .then((token) => {
    // Access token obtained successfully
    console.log(token);
  })
  .catch((error) => {
    // Error occurred while obtaining the access token
    console.log(error);
  });