Download the PHP package nyanumba-codes/pesapal without Composer

On this page you can find all versions of the php package nyanumba-codes/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 pesapal

Pesapal API Integration Package for Laravel

A Laravel package that simplifies integration with the Pesapal payment gateway. This package allows developers to easily handle Pesapal's functionalities such as IPN (Instant Payment Notifications) registration, processing payments, and managing callbacks. Designed to work seamlessly with Laravel projects, including those using Livewire.

Features

Installation

Install the package via Composer:

Publish the configuration file (Optional):

The configuration file config/pesapal.php will be created. Update it with your Pesapal credentials (Already done for you).

Configuration

Add the following variables to your .env file:

Update the config/pesapal.php file if you need to customize default settings.

Usage

1. Registering an IPN

IPN stands for Instant Payment Notification. When a payment is made against a transaction, Pesapal will trigger an IPN call to the notification URL related to this transaction. This notification URL is usually located on your servers. These notifications allows you to be alerted in real time whenever there is a status change for any transaction.

Use the Pesapal class to register an IPN:

Depending on the IPN URL that you set up in your .env file, the URL will be registered accordingly.

2. Get Registered IPNs

This endpoint allows you to fetch all registered IPN URLs for a particular Pesapal merchant account.

3. Making a Payment (Submit Order Request)

To initiate a payment:

Please Note that the $notification_id represents an IPN URL which Pesapal will send notifications to after payments have been processed.

You are required to register all IPN URLs after which a corresponding notification_id will be generated. Please refer to the IPN URL registration endpoint in the Pesapal API 3.0 documentation.

4. Handling Callbacks

Define callback routes in your routes/api.php:

Create the PaymentController controller as defined in the routes:

In your controller create the function handleCallback():

5. Get Transaction Status

Once Pesapal redirect your customer to your callback URL and triggers your IPN URL, you need to check the status of the payment using the OrderTrackingId.

This tracking ID is a unique order ID taht is generated by Pesapal from the data received in the initial response of the Submitted Order Request when making the payment.

Here is a Sample of the Response:

From that point it would have been best to store this data into the database so that you may query to check the status of the transaction.

6. Recurring Payments

In the process of making a payment there are extra options that this package has allowed you to add. These are the account_number and subscription_details.

The following is a sample of a subscription_details object in PHP

frequency: The period billed to the account is set out in the user contract. For instance, if users subscribe to a monthly service. Accepted values include DAILY, WEEKLY, MONTHLY or YEARLY

7. Refund Request

The refund request function allows you to refund a charge that has previously been processed but not yet refunded. Funds will be refunded to the credit / debit card or mobile money wallet that was originally charged.

8. Order Cancellation

The Order Cancellation Function enables you to revoke a previously placed order request that remains incomplete on our end. This API facilitates the cancellation of orders that have encountered failures or are pending transactions.

$trackingId: This refers to the original Pesapal Order tracking ID that was returned after submitting your order request earlier during the initial submit order request api call. It is similar to the one used to get the transaction status.

Testing

You can test the package in multiple environments:

  1. Base Laravel Application: Create a controller and use the Pesapal class directly to process payments and handle callbacks.
  2. Livewire: Create a Livewire component, inject the Pesapal class, and bind payment functionality to Livewire actions.
  3. Inertia: Use Inertia to create Vue or React components and interact with the Pesapal class via API routes or Laravel controllers.

Ensure you have a valid Pesapal account and sandbox credentials for testing.

Security

Contributions

Contributions, issues, and feature requests are welcome! Feel free to fork the repository and submit pull requests.

License

This package is open-sourced software licensed under the MIT license.



All versions of pesapal with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
illuminate/support Version ^11.0|^12.0
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 nyanumba-codes/pesapal contains the following files

Loading the files please wait ....