mwanziamutua/omnipay-pesapal

Pesapal V3 gateway for Omnipay payment processing library

v1.0.0.01 2022-11-12 21:58 UTC

This package is auto-updated.

Last update: 2024-04-13 01:33:59 UTC


README

Pesapal API v3 driver for the Omnipay PHP payment processing library

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 7.2+. This package implements the latest Pesapal API support for Omnipay.

Pesapal gateway API documentation

Installation

This package is installed via Composer. To install, simply add it to your composer.json file:

composer require mwanziamutua/pesapal

Basic Usage

The following gateways are provided by this package:

  • Pesapal

You need to set your consumerKey, and consumerSecret. Setting testMode to true will use the sandbox environment.

Process your customer order like so:

$gateway = GatewayFactory::createInstance($consumerKey, $consumerSecret, true);

try {
    $orderNo = uniqid('', true);
    $returnUrl = 'http://localhost:80/gateway-return.php';
    $notifyUrl = 'http://127.0.0.1/online-payments/uuid/notify';
    $ipnId = ' b62dbd97-3b95-43d2-8969-df616360f0ab';
    $description = 'Shopping at myAwesomeStore.com';

    $pesapalOrder = [
        'purchaseData' => [
            'id' => $orderNo,
            'amount'            => 150,
            'currency'          => 'KES',
            'description' => $description,
            'callback_url' => $returnUrl,
            'notification_id' => $ipnId,
            'billing_address'  => [
                "email_address" => "john.doe@example.com",
                "phone_number" => null,
                "country_code" => "",
                "first_name" => "John",
                "middle_name" => "",
                "last_name" => "Doe",
                "line_1" => "",
                "line_2" => "",
                "city" => "",
                "state" => "",
                "postal_code" => null,
                "zip_code" => null
            ]
        ],
    ];


    $response = $gateway->purchase($pesapalOrder);

For general usage instructions, please see the main Omnipay repository.

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.