{"id":13697011,"url":"https://github.com/GraHms/mpesa-rust-sdk","last_synced_at":"2025-05-03T17:32:45.161Z","repository":{"id":188309610,"uuid":"678506493","full_name":"GraHms/mpesa-rust-sdk","owner":"GraHms","description":"A Rust library to interact with the MPesa API, simplifying B2C payment integrations and more.","archived":false,"fork":false,"pushed_at":"2023-08-17T05:34:09.000Z","size":14,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-26T16:07:44.300Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GraHms.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-08-14T17:56:32.000Z","updated_at":"2024-08-29T23:02:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"e316e686-c740-41ca-9755-b815e612b090","html_url":"https://github.com/GraHms/mpesa-rust-sdk","commit_stats":null,"previous_names":["grahms/mpesa-rust-sdk"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GraHms%2Fmpesa-rust-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GraHms%2Fmpesa-rust-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GraHms%2Fmpesa-rust-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GraHms%2Fmpesa-rust-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GraHms","download_url":"https://codeload.github.com/GraHms/mpesa-rust-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252226913,"owners_count":21714894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T18:00:51.438Z","updated_at":"2025-05-03T17:32:44.907Z","avatar_url":"https://github.com/GraHms.png","language":"Rust","funding_links":[],"categories":["Bibliotecas"],"sub_categories":[],"readme":"## MPesa SDK (Rust Library)\n\nA Rust library to interact with the MPesa API, simplifying B2C payment integrations and more.\n\n### Features\n\n- Configuration management for API and public keys.\n- Easy B2C Payment initiation.\n- Customizable headers and parameters for requests.\n- Built-in encryption and token generation for request authentication.\n- Comprehensive error handling with the `MPesaError` enum.\n\n### Getting Started\n\n#### Prerequisites\n\n- Rust compiler and Cargo.\n- An MPesa Developer account to obtain API and public keys.\n\n#### Installation\n\nInclude this in your `Cargo.toml`:\n\n```toml\n[dependencies]\nmpesa_sdk = \"0.1.0\"\n```\n\nThen, build your project with:\n\n```bash\n$ cargo build\n```\n\n#### Basic Usage\n\n```rust\nuse mpesa_sdk::{MPesaClient, data::B2CInput};\n\nlet client = MPesaClient::new(\"YOUR_API_KEY\", \"YOUR_PUBLIC_KEY\");\nlet mut payment_request = B2CInput::new();\n\npayment_request.set_transaction_reference(\"TRANSACTION_REF\");\npayment_request.set_customer_msisdn(\"258848255237\");\npayment_request.set_amount(\"1000\");\npayment_request.set_third_party_reference(\"THIRD_PARTY_REF\");\npayment_request.set_service_provider_code(\"171717\");\n\nlet response = client.b2c_payment(\u0026payment_request);\n\nmatch response {\n    Ok(resp) =\u003e println!(\"{:?}\", resp),\n    Err(e) =\u003e eprintln!(\"Error: {:?}\", e),\n}\n```\n\n### Error Handling\n\nThe SDK uses the `MPesaError` enum for comprehensive error feedback. When making requests, results can be pattern-matched against these errors:\n\n```rust\nmatch result {\n    Ok(data) =\u003e {\n        // Process success scenario\n    },\n    Err(MPesaError::NetworkError(_)) =\u003e {\n        // Handle network errors\n    },\n    Err(MPesaError::SerializationError(_)) =\u003e {\n        // Handle serialization errors\n    },\n    // ... other specific errors\n    Err(_) =\u003e {\n        // Handle general or unknown errors\n    }\n}\n```\n\nFor a full list of error variants, refer to the `MPesaError` documentation.\n\n### Contributing\n\nWe welcome contributions! Whether it's bug fixes, feature additions, or documentation improvements, your input is valuable. For significant changes, please open an issue for discussion before making a pull request.\n\n### License\n\nThis SDK is under the [MIT License](https://choosealicense.com/licenses/mit/).\n\n---\n\nThis README aims to provide clear, concise instructions to quickly get users started. Over time, consider enhancing the documentation by including more in-depth tutorials, best practices, or use-case examples to further guide users.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGraHms%2Fmpesa-rust-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGraHms%2Fmpesa-rust-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGraHms%2Fmpesa-rust-sdk/lists"}