ericmuigai/pesapal

This is a Pesapal package for Laravel 5 .Please test it first before deploying.

Downloads

1730

Stars

8

Version

Pesapal package for Laravel

Introduction

This is a Laravel 5.* pesapal package. I provided this package as to help since pesapal do not have a package for Laravel. Pesapal do not have a way to test this so I guess you will have to send money payments to test. Please do ping me whenever you need something.

For Laravel 4.2

Installation

add
"ericmuigai/pesapal": "3.0.x-dev"
to your composer.json and then
composer update
this will install the package Once the package is installed add
'Ericmuigai\Pesapal\PesapalServiceProvider',
to the providers. after this publish the config file by
php artisan config:publish ericmuigai/pesapal
then migrate the package table by using
php artisan vendor:publish
Go to your pesapal account and in the ipn url enter
yoursite.com/listenipn
or or the url to your public path/listenipn
You should now find the config.php in the
config/pesapal.php 

Configuration

This is what you should see in the config.php
/**
 * this settings are needed in order to work with pesapal
 * enabled(bool) -if true sets the pesapal to live instead of demo website that was not functioning at the time of writing this package
 * consumer_key the consumer key gotten from the pesapal website
 * consumer_secret- The consumer secret gotten from the pesapal website.
 * controller - This is the controller that will be called if the status is valid. A method updateItem($key, $pesapal_merchant_reference) will be called.
 * please note the method that will be called will be updateItem and should be static that is update($key,$reference)
 * Key- the key to protect the method from being called elsewhere
 * redirectTo - the link to where your thankyou page is
 * email - Your email address where you will be emailed on complete transaction
 * name - your name
 * currency - the currency that will be used on payment
 *
 */
return array(
'enabled' => true,
'consumer_key' => "",
'consumer_secret'=>"",
'controller'=>"YourController",
'key'=>"12345",
'redirectTo'=>"/",
'email'=>"[email protected]",
'mail'=>true,
'name'=>"Admin",
'currency'=>"KES",

);

You are now set once the right info is entered.

How to use

Now you should be able to call the
Pesapal::Iframe($array)
from any view you would like the iframe to appear. The array should have this info in the
$array
/**
     * generates the iframe from the given details
     * @param array $values this array should contain the fields required by pesapal
     * description - description of the item or service
     * currency - if set will override the config settings you have of currency
     * user -which should be your client user id if you have a system of users
     * first_name- the first name of the user that is paying
     * last_name - the last name of the user that is paying
     * email - this should be a valid email or pesapal will throw an error
     * phone_number -which is optional if you have the email
     * amount - the total amount to be posted to pesapal
     * reference Please Make sure this is a unique key to the transaction. An example is the id of the item or something
     * type - default is MERCHANT
     * frame_height- this is the height of the iframe please provide integers as in 900 without the px
     *
     */'
     

Author

Eric Muigai- http://www.hot254.co.ke

License

Licensed under MIT
ericmuigai

Author

ericmuigai