Skip to content

Latest commit

 

History

History
35 lines (27 loc) · 868 Bytes

onboard.md

File metadata and controls

35 lines (27 loc) · 868 Bytes

Onboard

Creates a OnboardBuilder which allows you to opt in as a biller to the bill manager features.

Safaricom API docs reference

Example

use mpesa::{Mpesa, Environment, SendRemindersTypes};

#[tokio::main]
async fn main() {
    dotenvy::dotenv().ok();

    let client = Mpesa::new(
        dotenvy::var("CONSUMER_KEY").unwrap(),
        dotenvy::var("CONSUMER_SECRET").unwrap(),
        Environment::Sandbox,
    );

    let response = client
        .onboard()
        .callback_url("https://testdomain.com/true")
        .email("[email protected]")
        .logo("https://file.domain/file.png")
        .official_contact("0712345678")
        .send_reminders(SendRemindersTypes::Enable)
        .short_code("718003")
        .send()
        .await;

    assert!(response.is_ok());
}