Download the PHP package bryceandy/laravel_pesapal without Composer

On this page you can find all versions of the php package bryceandy/laravel_pesapal. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel_pesapal

Pesapal package for Laravel apps

Actions Status Total Downloads Latest Stable Version License
Donate to this project using Patreon

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

Now run

Configuration

Next we publish the configuration file that comes with the package

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.

Thereafter, run the migration command as the package will load a database migration that stores the payment records

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 http://yourwebsite.com/callback

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 route /pesapal/iframe where you can post the data as follows:

For the type field, leave the default as MERCHANT. If you use ORDER, be sure to read the Pesapal documentation first.

When the data is posted successfully, you will have a view of the form to make payments.

A new payment record will be recorded in your pesapal_payments table, now you can choose the payment option you prefer.

Fetching the payment status.

After making the payment you will be redirected to the callback URL as mentioned above, and Pesapal will redirect with two query parameters:

With these two we can now:

A. Use these parameters to query the payment status to display to the user.

Normally on your callback page you can display whatever you need to your customer to show that the payment is being processed.

But because Pesapal will send the payment tracking Id which you have not recorded, you can save this unique tracking Id for your payment and also query for the payment status.

In the controller method where you display the callback page, query the status:

This way requires you to refresh the page because you may not know when the status has changed.

If this does not have a good user experience, you may setup an 'IPN listener' where Pesapal notifies you when a payment status has changed.

B. Setting up an IPN (Instant Payment Notifications) listener.

This only applies to merchant accounts. Create a route for your IPN listener, for example a GET request to /pesapal-ipn-listener

Your IPN Controller could look like this:

This controller method will be called every time Pesapal sends you an IPN notification until the payment is completed or has failed.

IMPORTANT

Register IPN settings

On your Pesapal dashboard find your Account Settings and click IPN Settings.

Fill in your website domain for example yourWebsite.com and IPN listener URL, for example yourWebsite.co.tz/pesapal-ipn-listener.

This is important so that Pesapal can send IPN notifications.

License

MIT License.

Contributors

This package is based from the PHP API of Pesapal

Sponsorship

If you enjoy using this package, consider contributing to the maintainer

Donate to this project using Patreon


All versions of laravel_pesapal with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
ext-curl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bryceandy/laravel_pesapal contains the following files

Loading the files please wait ....