Logo Lanfrica

Alloys9/mpesa-rahisi

Domaine:

digital infrastructuresocioeconomic

Type de record:

software
Créateur:
All
Hôte:
M-PESA rahisi is a Laravel package that simplifies the integration of M-Pesa payment services into your Laravel applications. This package allows you to seamlessly process payments, handle transaction callbacks, and manage customer billing through Safaricom's M-Pesa API. # M-PESA rahisi **Mpesa Rahisi** provides an easy integration of M-Pesa payment services with your Laravel application, allowing you to process payments, handle transaction callbacks, and manage customer billing through Safaricom's M-Pesa API. ## Features - Seamless M-Pesa integration with Laravel applications. - Easy-to-use interface for initiating STK push requests. - Automatically handles M-Pesa callback URLs and updates transactions. - Configuration options to customize M-Pesa API settings. - Compatible with Laravel 11.x. ## Installation ### Step 1: Install the package via Composer ```bash composer require alloys9/mpesa_rahisi:dev-main@dev ``` ### Step 2: Run the installation command The next step is to publish the application configurations. Run the following command ```bash php artisan mpesa-rahisi:install ``` This command will: - Replace the config/app.php file - Copy controllers to app/Http/Controllers - Copy migrations to database/migrations - Copy models to app/Models - Copy views to resources/views - Append necessary routes to routes/web.php - Replace the CSRF middleware file ### Step 3: Migrate the database Run the following command to migrate the necessary database tables: ```bash php artisan migrate ``` ### Step 4: Add the following to your .env file to save the variables ```bash MPESA_ENVIRONMENT= SAFARICOM_PASSKEY= MPESA_BUSINESS_SHORTCODE= MPESA_CONSUMER_KEY= MPESA_CONSUMER_SECRET= MPESA_INITIATOR_PASSWORD= MPESA_INITIATOR_NAME= MPESA_SHORTCODE= MPESA_CALLBACK_URL="${APP_URL}/payments/stkcallback" MPESA_TEST_URLPRE="sandbox.safaricom.co.ke" MPESA_TOKEN_URL="${MPESA_TEST_URLPRE}/oauth/v1/generate?grant_type=client_credentials" MPESA_INITIATE_URL="${MPESA_TEST_URLPRE}/mpesa/stkpush/v1/processrequest" MPESA_STK_QUERY_URL="${MPESA_TEST_URLPRE}/mpesa/stkpushquery/v1/query" MPESA_SIMULATE_URL="${MPESA_TEST_URLPRE}/mpesa/c2b/v1/simulate" MPESA_REGISTER_URL="${MPESA_TEST_URLPRE}/mpesa/c2b/v1/registerurl" MPESA_CONFIRMATION_U …