[][src]Crate mpesa

About

A Rust wrapper around the Safaricom API for accessing M-Pesa services.

Notes

Warning! v0.*. Expect bugs therefore not recommended for use in production. Pull requests and issues very welcome.

Install & Usage

In your Cargo.toml file:

[dependencies]
mpesa = "0.1.6"

In your lib or binary crate:

use mpesa::Mpesa;

Examples

Use dotenv crate to store your keys as environmental variables instead of hard coding them like done in the example below.

use mpesa::{Mpesa, Environment};
use std::env;

let client = Mpesa::new(
      env::var("CLIENT_KEY")?,
      env::var("CLIENT_SECRET")?,
      Environment::Sandbox,
      env::var("INIT_PASSWORD")?,
);

Author

Collins Muriuki

License

This project is MIT licensed

Re-exports

pub use constants::CommandId;
pub use constants::IdentifierTypes;
pub use environment::Environment;
pub use mpesa_security::MpesaSecurity;

Modules

constants
environment
mpesa_security
payloads

Structs

Mpesa

Mpesa client that will facilitate communication with the Safaricom API

Enums

ResponseType

C2B Register Response types