Logo Lanfrica

bryceandy/laravel_pesapal

Domaine:

digital infrastructure

Type de record:

software
Créateur:
bry
Hôte:
An unofficial Pesapal API integration for Laravel. Multiple payment options including but not limited to M-Pesa, Tigo Pesa, Visa, Mastercard, American Express in East Africa. # Pesapal package for Laravel apps This package enables Laravel developers to easily make use of the Pesapal API. ## Version support | Laravel version | Package version | Maintenance | | --- | --- | --- | | 5.7 - 6 | 1.0.0 - 1.0.1 | No longer maintained | | 7 and above | 2.* | Actively maintained | ## Installation Pre-installation requirements * A running or newly installed Laravel 7.* or above * PHP 7.4 or above * cURL extension installed Now run ```bash composer require bryceandy/laravel_pesapal ``` ## Configuration Next we publish the configuration file that comes with the package ```bash php artisan vendor:publish --tag=pesapal-config ``` After publishing, you will find a `pesapal.php` file in your `config` directory Head over to demo if you want a testing environment or live for a live integration and create a business account. You will obtain a key-secret pair for your integration Inside your `.env` file, create these environment variables and they will be used to set configuration values available in the published `config/pesapal.php` file Use the keys you obtained from Pesapal to fill the key and secret. If you are on a live account, set the **is_live** variable to true. ```dotenv PESAPAL_KEY=yourConsumerKey PESAPAL_SECRET=yourConsumerSecret PESAPAL_IS_LIVE=false PESAPAL_CALLBACK_URL= ``` Thereafter, run the migration command as the package will load a database migration that stores the payment records ```bash php artisan migrate ``` ## Usage ### Before making a payment, setup a callback page. Create a callback page and register its URL in the `PESAPAL_CALLBACK_URL` environment variable. This can be something like `yourwebsite.com` Once a payment process has been completed by the user, Pesapal will redirect to your site using the url. ### Making a request to Pesapal for a payment. Pesapal requires a request sent to their API in order to display the form like the one we see above This package comes with a ro …