Skip to content

johninvictus/mpesa_elixir

Repository files navigation

MPESA ELIXIR

ELixir Wrapper for Mpesa Daraja APIs https://developer.safaricom.co.ke/APIs

Table of contents

Features

  • STK Push
  • C2B
  • QRCode
  • Request universal MPESA API call

Installation

If available in Hex, the package can be installed by adding mpesa_elixir to your list of dependencies in mix.exs:

def deps do
  [
    {:mpesa_elixir, "~> 0.2.1"}
  ]
end

Configuration

Create a copy of config/dev.exs or config/prod.exs from config/dev.sample.exs Use the sandbox key to true when you are using sandbox credentials, change to false when going to :prod, this will change the baseurl to point to production

Mpesa (Daraja)

Mpesa Daraja API link: https://developer.safaricom.co.ke

Add below config to dev.exs / prod.exs files This asumes you have a clear understanding of how Daraja API works.

In this wrapper I decided to only add credentials to config for flexibility and avoid config bloating. Add these configuration to runtime config (for production)

config :mpesa_elixir,
  sandbox: true, # change this if you are in production
  consumer_key: "your consumer key",
  consumer_secret: "your consumer secret",
  pass_key: "your pass key"

If you dont want to start the auth server when testing, add this to your test.exs, you need to do this in order to avoid auth warnings when testing, by default it is set to true

config :mpesa_elixir,
  auto_start_auth_server: false

Documentation

The docs can be found at https://hexdocs.pm/ex_mpesa

Contribution

If you'd like to contribute, start by searching through the issues and pull requests to see whether someone else has raised a similar idea or question. If you don't see your idea listed, Open an issue.

Check the Contribution guide on how to contribute.

Contributors

Auto-populated from: contributors-img

Licence

MPESA ELIXIR is released under MIT License

license

About

Mpesa wrapper for mpesa API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages