PHPackages                             rainwaves/paygate-payment - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. rainwaves/paygate-payment

ActiveLibrary[Payment Processing](/categories/payments)

rainwaves/paygate-payment
=========================

A package for integrating with the PayGate payment gateway

v1.2.0(2y ago)014MITPHPPHP ^7.4|^8.0|^8.1|^8.2

Since Jul 6Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Magnificent-Big-J/paygate-payment)[ Packagist](https://packagist.org/packages/rainwaves/paygate-payment)[ RSS](/packages/rainwaves-paygate-payment/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (5)Used By (0)

PayGate Payment Package
=======================

[](#paygate-payment-package)

The PayGate Payment Package provides a convenient way to integrate with the PayGate payment gateway for processing online payments. For more information, visit the [PayGate Documentation](https://docs.paygate.co.za).

Installation
------------

[](#installation)

You can install the PayGate Payment Package via Composer. Run the following command in your project directory:

```
composer require rainwaves/paygate-payment
```

Configuration
-------------

[](#configuration)

After installing the package, you need to configure it with your PayGate credentials. In Laravel, you'll need to publish the config file and set the credentials in your .env file:- PAYGATE\_ID=XXXXXXXX

- PAYGATE\_SECRET=XXXXXXXXXX
- PAYGATE\_NOTIFICATION\_URL=XXXXXXXX
- PAYGATE\_RETURN\_URL=XXXXXXXXXXXX
- PAYGATE\_SUBS\_RETURN\_URL=XXXXXXXXXXXX

Usage
-----

[](#usage)

### Vanilla PHP

[](#vanilla-php)

```
require 'vendor/autoload.php';

// Create an instance of PayWebClient with your PayGate credentials
$client = new PayWeb('10011072130', 'secret');
$transactionDate = Carbon::now()->format('Y-m-d H:i:s');

// Initialize payment
$inputData = [
    'reference' => 'order_123',
    'amount' => 1599.00,
    'currency' => 'ZAR',
    'returnUrl' => 'https://example.com/return',
    'notifyUrl' => 'https://example.com/notify',
    'transactionDate'   => $transactionDate,
    'locale' => 'en-za',
    'country' => 'ZAF',
    'email' => 'customer@paygate.co.za',
];
$response = $client->initiatePayment($inputData);

// Generate the payment form
$formHtml = $client->createForm();

// Display the payment form to the user
echo $formHtml;
```

A form with to submit the data to paygate will be generated.

### Laravel

[](#laravel)

Assuming you have the necessary routes and views set up, here's an example of how to use the PayGate Payment Package in Laravel:

```
class PaymentController extends Controller
{
    public Collection $products;
    protected PayWebInterface $payWeb;
    protected PaySubsInterface $paySubs;

    public function __construct(PayWebInterface $payWeb, PaySubsInterface $paySubs)
    {
        $this->products = $this->setProducts();
        $this->payWeb = $payWeb;
        $this->paySubs = $paySubs;

    }

    public function products()
    {
        $products = $this->products->toArray();
        return view('welcome', compact('products'));
    }
    public function response(Request $request)
    {
        $response = new PayGateNotifyResponse($request->toArray());
        Log::debug(json_encode("========================Return response================================"));
        Log::debug(json_encode($request->all()));
    }

    public function notify(Request $request)
    {
        $response = new PayGateNotifyResponse($request->toArray());
        Log::debug(json_encode("========================Notify response================================"));
        Log::debug(json_encode($request->all()));
    }

    public function payment($id)
    {
        $transactionDate = Carbon::now()->format('Y-m-d H:i:s');

        $product = $this->products->first(function ($product) use ($id) {
            return $product['id'] === (int)$id;
        });
        $inputData = [
            'reference' => uniqid('pgtest_'),
            'amount' => $product['price'],
            'currency' => 'ZAR',
            'returnUrl' => config('paygate.return_url'),
            'notifyUrl' => config('paygate.notification_url'),
            'transactionDate'   => $transactionDate,
            'locale' => 'en-za',
            'country' => 'ZAF',
            'email' => 'customer@paygate.co.za',
        ];

        $this->payWeb->initiatePayment($inputData);
        $formHtml = $this->payWeb->createForm();

        return view('payment', compact('product', 'formHtml'));
    }

    public function subscription()
    {
        $transactionDate = Carbon::now()->format('Y-m-d H:i:s');
        $startDate = Carbon::now()->addMonth()->startOfMonth()->format('Y-m-d');
        $endDate = Carbon::now()->addYear()->endOfMonth()->format('Y-m-d');
        $data = array(
            'version'            => 21,
            'reference'          => 'pgtest_123456789',
            'amount'             => 20000.00,
            'currency'           => 'ZAR',
            'returnUrl'         => 'https://fec0-41-216-202-254.ngrok-free.app/sub-response',
            'transactionDate'   => $transactionDate,
            'subsStartDate'    => $startDate,
            'subsEndDate'      => $endDate,
            'subsFrequency'     => 228,
            'processNow'        => 'YES',
            'processNowAmount' => 32.99,
        );

        $htmlForm = $this->paySubs->createSubscriptionAndChain($data)->createForm();

        return view('form', compact('htmlForm'));
    }

    public function subResponse(Request $request)
    {
        Log::debug(json_encode("========================Subscription response================================"));
        Log::debug(json_encode($request->all()));
    }
    private function setProducts(): Collection
    {
        return collect([
             [
                'id'=> 1,
                'name' => 'Product 1',
                'description' => 'Description of Product 1',
                'price' => 321.99,
            ],
            [
                'id'=> 2,
                'name' => 'Product 2',
                'description' => 'Description of Product 2',
                'price' => 245.99,
            ],
            [
                'id'=> 3,
                'name' => 'Product 3',
                'description' => 'Description of Product 3',
                'price' => 159.99,
            ],
        ]);
    }
}
```

Make sure to replace 'your\_paygate\_id' and 'your\_encryption\_key' with your actual PayGate ID and encryption key.

Testing
-------

[](#testing)

To run the PHPUnit test cases for the package, use the following command:

vendor/bin/phpunit

License
-------

[](#license)

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

Make sure to replace `'your_paygate_id'` and `'your_encryption_key'` with your actual PayGate ID and encryption key.

Feel free to customize the README further based on your package's specific features and usage instructions.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

3

Last Release

1044d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d883daa69ded754005d02d8e31aec80f0ef4c73cfd20b9d3f6daad32dce0d0cb?d=identicon)[Magnificent-Big-J](/maintainers/Magnificent-Big-J)

---

Top Contributors

[![Magnificent-Big-J](https://avatars.githubusercontent.com/u/30896750?v=4)](https://github.com/Magnificent-Big-J "Magnificent-Big-J (85 commits)")

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/rainwaves-paygate-payment/health.svg)

```
[![Health](https://phpackages.com/badges/rainwaves-paygate-payment/health.svg)](https://phpackages.com/packages/rainwaves-paygate-payment)
```

###  Alternatives

[lemonsqueezy/laravel

A package to easily integrate your Laravel application with Lemon Squeezy.

58596.1k](/packages/lemonsqueezy-laravel)[shetabit/multipay

PHP Payment Gateway Integration Package

291348.2k3](/packages/shetabit-multipay)[imdhemy/google-play-billing

Google Play Billing

491.3M5](/packages/imdhemy-google-play-billing)[buckaroo/sdk

Buckaroo payment SDK

12189.1k9](/packages/buckaroo-sdk)[contica/facturador-electronico-cr

Un facturador de código libre para integrar facturación electrónica en Costa Rica a un proyecto PHP

2128.8k](/packages/contica-facturador-electronico-cr)[mrprompt/cielo

Integration with Cielo gateway.

481.9k1](/packages/mrprompt-cielo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
