jchegenye / mypesapal
A simplified PesaPal integration for your Laravel App.
v1.0.1
2019-04-08 08:27 UTC
Requires
- php: >=5.4.0
- illuminate/support: ~5.0
Requires (Dev)
- mockery/mockery: dev-master
- phpunit/phpunit: ^6.1
This package is auto-updated.
Last update: 2024-11-23 05:02:57 UTC
README
A simplified PesaPal integration for your Laravel App.
Installation
Via Composer
composer require jchegenye/mypesapal
Usage
Add this class to your Controller.
use App\Http\JTech\PesaPal\PesaPalIframe;
Run this vendor:publish
command to publish Pesapal configaration file.
What's inside config file?
1. Application Environment:
| Pesapal will utilize this option to determine which
| mode your App is running, either Sandbox or Live
|
| Local - Means your App is running on a Sandbox Mode.
| Production - Means your App is running on a Live Mode
2. Authentication / Configuration
| 'token_params' => NULL,
| 'consumer_key' => env('PESAPAL_CONSUMER_KEY', '*** CONSUMER KEY ***'),
| 'consumer_secret' => env('PESAPAL_CONSUMER_SECRET', '*** YOUR CONSUMER SECRET ***'),
| 'live_iframelink' => 'https://www.pesapal.com/API/PostPesapalDirectOrderV4',
| 'demo_iframelink' => 'http://demo.pesapal.com/api/PostPesapalDirectOrderV4'
3. Define the callback_url
| This is the full url pointing to the page the iframe redirects to
| after processing the order on pesapal.com
'callback_url' => env('PESAPAL_CALLBACK_URL', 'http://test.com/payment-gateways-php/pesapal-php/'),
4. Field Names
| You may wish for to select prefered form details posted by your
| App to be used by pesapal.
|
| You can add more `Fields` here if you wish.
|
| NOTE: default value = MERCHANT
'fields' => [
'amount' => 'number_format(PESAPAL_FIELD_AMOUNT, 2)', //format amount to 2 decimal places
'description' => 'PESAPAL_FIELD_DESC',
'type' => 'MERCHANT', //default value = MERCHANT
'reference' => 'PESAPAL_FIELD_REF', //unique order id of the transaction, generated by merchant
'first_name' => 'PESAPAL_FIELD_FNAME',
'last_name' => 'PESAPAL_FIELD_LNAME',
'email' => 'PESAPAL_FIELD_EMAIL',
'phonenumber' => 'PESAPAL_FIELD_PHONE' //ONE of email or phonenumber is required
]
To return Pesapal Response
use this pesapal()
Method.
In-order for Pesapal to obtain an instance of the current HTTP Request
add this $request
variable.
See below example:
response()->pesapal($request);