evance-odhiambo/mpesa-payment

Facilitates easy MPESA payments

dev-main 2024-09-07 12:28 UTC

This package is auto-updated.

Last update: 2025-05-07 14:02:01 UTC


README

Latest Version on Packagist Total Downloads GitHub Actions

This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.

Installation

You can install the package via composer:

composer require evance-odhiambo/mpesa-payment

Usage

after Installation add In array of providers in config/app.php Put

EvanceOdhiambo\MpesaPayment\MpesaPaymentServiceProvider::class

and In aliases Put

EvanceMpesa' => EvanceOdhiambo\MpesaPayment\MpesaPaymentFacade::class to aliases

Then run

php artisan vendor:publish --tag=config 

Inside config there is a file called evance-mpesa.php created just confirm

Now copy

MPESA_ENV=sandbox
CONSUMER_KEY=
CONSUMER_SECRET=
PAYBILL=174379
SHORTCODE=174379
PASSKEY=
C2B_VALIDATE_CALLBACK=
C2B_CONFIRM_CALLBACK=
CALLBACK_URL=
ACC_REF=

to your .env and fill with your details.

  1. To Register C2B urls just call the bellow fn fromyour
 $response=EvanceMpesa::registerUrls()

Successfull registration results to

{
  "OriginatorCoversationID": "23311-116912840-1",
  "ResponseCode": "0",
  "ResponseDescription": "Success"
}

2 To initial Mpesa Express (C2B Payments) call

 $response=EvanceMpesa::express(1030,'714611350',$acc_ref,'Remarks')

Upon successfull stk push

{
  "MerchantRequestID": "101796-19195815-1",
  "CheckoutRequestID": "ws_CO_29062023231703226715711360",
  "ResponseCode": "0",
  "ResponseDescription": "Success. Request accepted for processing",
  "CustomerMessage": "Success. Request accepted for processing"
}

NOTE

This Package is still under Development

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email evanceodhiambo07@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.