{"id":15293811,"url":"https://github.com/lawrence615/mpesa","last_synced_at":"2025-07-26T08:33:06.965Z","repository":{"id":57012844,"uuid":"78652003","full_name":"lawrence615/mpesa","owner":"lawrence615","description":null,"archived":false,"fork":false,"pushed_at":"2017-07-10T07:36:25.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-03T01:33:52.518Z","etag":null,"topics":["c2b","event-listener","events-triggered","laravel-5-package","laravel5","mobidev","mpesa-api","payments","php","safaricom","soap"],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/lawrence615.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}},"created_at":"2017-01-11T15:27:46.000Z","updated_at":"2017-07-21T09:14:39.000Z","dependencies_parsed_at":"2022-08-21T15:10:51.301Z","dependency_job_id":null,"html_url":"https://github.com/lawrence615/mpesa","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/lawrence615/mpesa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lawrence615%2Fmpesa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lawrence615%2Fmpesa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lawrence615%2Fmpesa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lawrence615%2Fmpesa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lawrence615","download_url":"https://codeload.github.com/lawrence615/mpesa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lawrence615%2Fmpesa/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267140682,"owners_count":24041970,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["c2b","event-listener","events-triggered","laravel-5-package","laravel5","mobidev","mpesa-api","payments","php","safaricom","soap"],"created_at":"2024-09-30T16:53:22.443Z","updated_at":"2025-07-26T08:33:06.576Z","avatar_url":"https://github.com/lawrence615.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mpesa API Implementation\n\n[![Latest Stable Version](https://poser.pugx.org/lawrence615/mpesa/v/stable)](https://packagist.org/packages/lawrence615/mpesa)\n[![Total Downloads](https://poser.pugx.org/lawrence615/mpesa/downloads)](https://packagist.org/packages/lawrence615/mpesa)\n[![Latest Unstable Version](https://poser.pugx.org/lawrence615/mpesa/v/unstable)](https://packagist.org/packages/lawrence615/mpesa)\n[![License](https://poser.pugx.org/lawrence615/mpesa/license)](https://packagist.org/packages/lawrence615/mpesa)\n\nThis package is created to integrate MPesa Services i.e. C2B, B2C, B2B and Online Checkout in your Laravel app.\nIt allows you to receive and process soap sent by Safaricom. The package is still under heavy development and thus subject to bugs and changes.\n\n## Requirements\n- [PHP \u003e=5.6.0](http://php.net/)\n- [Laravel 5.x](https://github.com/laravel/framework)\n\n## Quick Installation\n```bash\ncomposer require \"lawrence615/mpesa:dev-master\"\n```\n\n#### Service Provider\n```php\nMobidev\\Mpesa\\MpesaServiceProvider::class\n```\n\n#### Configuration and Assets\n```bash\nphp artisan vendor:publish --provider=\"Mobidev\\Mpesa\\MpesaServiceProvider\"\n```\n\nThen run php artisan migrate to create the tables in you database. This will create two tables;\n\n1. mpesa_payment_logs table - logs everything received from Safaricom\n\n2. payments table - breaks down what is received from Safaricom into a number of columns\n\n\n## Receiver Route\nThe route that receives the IPN is `c2b/payments/receiver` i.e. http://example.com/c2b/payments/receiver. This is the endpoint you give to Safaricom.\n\n## Events\nThere are events triggered when certain actions happen. You can extend the package's behaviour by setting up your own event listeners to provide custom functionality.\n\nThese are the events triggered by the package. The list will grow with time as more events come up;\n\n| Event                | Available data          |\n|----------------------|-------------------------|\n|c2b.received.payment  | Full C2B Payment Object\n\n\n__C2B Payment Event Listener__\n\nCreate a Controller i.e. PaymentsController then create a function c2bPayment\n```php\n    //$payload will have the data from the event\n    public function c2bPayment($payload){\n       \n    }\n```\n\nRegister an event listener  in the boot method of your  EventServiceProvider:\n```php\nEvent::listen('c2b.received.payment', 'App\\Http\\Controllers\\PaymentsController@c2bPayment');\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flawrence615%2Fmpesa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flawrence615%2Fmpesa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flawrence615%2Fmpesa/lists"}