PHPackages                             maksa988/laravel-wayforpay - 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. maksa988/laravel-wayforpay

ActiveLibrary[Payment Processing](/categories/payments)

maksa988/laravel-wayforpay
==========================

WayForPay payments for Laravel

v1.0.2(5y ago)79.6k—10%10[1 PRs](https://github.com/maksa988/laravel-wayforpay/pulls)MITPHPPHP ^7.2CI failing

Since Oct 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/maksa988/laravel-wayforpay)[ Packagist](https://packagist.org/packages/maksa988/laravel-wayforpay)[ RSS](/packages/maksa988-laravel-wayforpay/feed)WikiDiscussions master Synced 1mo ago

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

Laravel payment processor package for WayForPay gateway
=======================================================

[](#laravel-payment-processor-package-for-wayforpay-gateway)

[![Latest Stable Version](https://camo.githubusercontent.com/fc45fc72e75a569acb9c5e0fdb562196d0c775b0477a9f45ed12d2ebe0994132/68747470733a2f2f706f7365722e707567782e6f72672f6d616b73613938382f6c61726176656c2d776179666f727061792f762f737461626c65)](https://packagist.org/packages/maksa988/laravel-wayforpay)[![StyleCI](https://camo.githubusercontent.com/d7668402b62ede7e1ce774af8ce3068b5ed947a5f9f11d562638937bf6c639bf/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3136353834313630312f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/165841601)[![CodeFactor](https://camo.githubusercontent.com/3669a7fa15d8ba0bc6fe1a904dfae485370768c8579d19b0ec70460a6fbeded2/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f6d616b73613938382f6c61726176656c2d776179666f727061792f6261646765)](https://www.codefactor.io/repository/github/maksa988/laravel-wayforpay)[![Total Downloads](https://camo.githubusercontent.com/5fcb618a3e03e6f527ca9bc98a58cbc2af16567206b5b042d5e893731012e30a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d616b73613938382f6c61726176656c2d776179666f727061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/maksa988/laravel-wayforpay)[![License](https://camo.githubusercontent.com/284acb3ac5b4259b802a4811caf48739794c551c07df62651b73d780eb19c0e1/68747470733a2f2f706f7365722e707567782e6f72672f6d616b73613938382f6c61726176656c2d776179666f727061792f6c6963656e7365)](https://packagist.org/packages/maksa988/laravel-wayforpay)

Accept payments via WayForPay ([wayforpay.com](https://wayforpay.com/)) using this Laravel framework package ([Laravel](https://laravel.com)).

- receive payments, adding just the two callbacks

#### Laravel &gt;= 5.5.\*, PHP &gt;= 7.2

[](#laravel--55-php--72)

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

[](#installation)

Require this package with composer.

```
composer require "maksa988/laravel-wayforpay"
```

If you don't use auto-discovery, add the ServiceProvider to the providers array in `config/app.php`

```
Maksa988\WayForPay\WayForPayServiceProvider::class,
```

Add the `WayForPay` facade to your facades array:

```
'WayForPay' => Maksa988\WayForPay\Facades\WayForPay::class,
```

Copy the package config to your local config with the publish command:

```
php artisan vendor:publish --provider="Maksa988\WayForPay\WayForPayServiceProvider"
```

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

[](#configuration)

Once you have published the configuration files, please edit the config file in `config/wayforpay.php`.

- Create an account and merchant on [wayforpay.com](http://wayforpay.com)
- Add your project, copy the `merchantAccount`, `merchantAccount`, `merchantSecretKey` params and paste into `config/wayforpay.php`
- After the configuration has been published, edit `config/wayforpay.php`

Usage
-----

[](#usage)

This package using official WayForPay SDK for PHP. You can find a full description and content of the classes used by this package in the official SDK repository - [wayforpay/php-sdk](https://github.com/wayforpay/php-sdk)

#### 1. Purchase

[](#1-purchase)

Purchase request is used to effect payment with client on the protected wayforpay site.

Official documentation -

The method `purchase()` allows you to prepare data for a widget or form. And also you can get an array with data to build your form.

```
$order_id = time(); // Payment`s order ID
$amount = 100; // Payment`s amount

$client = new \Maksa988\WayForPay\Domain\Client('John', 'Doe', 'johndoe@gmail.com');

$products = new \Maksa988\WayForPay\Collection\ProductCollection([
    new \WayForPay\SDK\Domain\Product('iPhone 12', 10, 1),
]);

//

$data = WayForPay::purchase($order_id, $amount, $client, $products)->getData(); // Array of data for using to create your own form.
$form = WayForPay::purchase($order_id, $amount, $client, $products)->getAsString($submitText = 'Pay', $buttonClass = 'btn btn-primary'); // Get html form as string
```

You can get JS code for widget () using `getWidget` method after call `purchase` method.

```
$widget = WayForPay::purchase($order_id, $amount, $client, $products)->getWidget($callbackJsFunction = null, $buttonText = 'Pay', $buttonClass = 'btn btn-primary'); // Get html form as string
```

#### 2. Charge

[](#2-charge)

Charge request is used for quick payment making in one action. It is performed within the limits of single-staged pattern.

The result of request processing is the withdrawal of monetary assets from client’s card.

Official documentation -

The method `charge()` allows you to send request for charge operation and get object of response.

```
$card = new \Maksa988\WayForPay\Domain\Card('5276999765600381', '05', '2021', '237', 'JOHN DOU');
$cardToken = new \Maksa988\WayForPay\Domain\Card('1aa11aaa-1111-11aa-a1a1-0000a00a00aa');
```

You can use `\Maksa988\WayForPay\Domain\Card::class` instead of `WayForPay\SDK\Domain\Card` and or `WayForPay\SDK\Domain\CardToken`. This class simplify input card and card token using one class. When you put only first argument, this card defined as card-token. If you are put all arguments, this be defined as bank card.

```
$response = WayForPay::charge($order_id, $amount, $client, $products, $card);
$response = WayForPay::charge($order_id, $amount, $client, $products, $cardToken);

echo "Status: ". $response->getTransaction()->getStatus();
```

#### 3. Check Status

[](#3-check-status)

Check Status request is used for checking of payment status on orderReference.

Official documentation -

The method `check()` allows you to send request for check status of your order using order id.

```
$order = WayForPay::check($order_id)->getOrder();

echo "Status: ". $order->getStatus();
```

#### 4. Refund

[](#4-refund)

Refund request is to be used for making of assets refund or cancellation of payment.

Official documentation -

The method `refund()` allows you to send request for refund of payment.

```
WayForPay::refund($order_id, $amount, $currency, $comment)->getTransactionStatus();
```

#### 5. Create invoice

[](#5-create-invoice)

The present API allows to issue invoices to the clients for payment for goods/services.

Official documentation -

The method `createInvoice()` allows you to create invoice.

```
$invoice = WayForpay::createInvoice($order_id, $amount, $client, $products);

$url = $invoice->getInvoiceUrl();
$qrCode = $invoice->getQrCode();
```

#### 6. Complete 3DS

[](#6-complete-3ds)

In case of merchantTransactionSecureTtype= 3DS, there is initially performed the checking of the card for participation in 3d secure program. If the card supports 3D Secure verification the system Wayforpay will return the parameters for authentication of the client. With these parameters the merchant has to transfer the client to url of issuer for authentication. The time during which the session for verification is active - 10 minutes. If within 10 minutes COMPLETE\_3DS will not be obtained the system will cancel transaction as unsuccessful.

```
$response = WayForPay::complete3ds($authTicket, $d3Md, $d3Pares);

$response->getTransaction();
```

#### 7. Handle payment

[](#7-handle-payment)

You can use handle payment process using service url at WayForPay. And using controller at Laravel with this package you can handle payment.

For handle request from wayforpay you should create controller and action. In the action you should use method `handleServiceUrl()`.

In the first argument you should put array of request data or `Arrayble` class. In the second argument you should put `Closure` what be called when payment is success, and this function will be passed two parameters: `Transaction` object and `Closure` using for create success response.

```
// Controller action

public function handle(Request $request)
{
    return WayForPay::handleServiceUrl($request, function (\WayForPay\SDK\Domain\Transaction $transaction, $success) {
        if($transaction->getReason()->isOK()) {

            // Payment confirmation process and etc...

            return $success();
        }

        return "Error: ". $transaction->getReason()->getMessage();
    });
}
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please send me an email at  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Maksa988](https://github.com/maksa988)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.4% 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 ~124 days

Total

4

Last Release

2023d ago

Major Versions

v0.1 → v1.0.02020-10-10

PHP version history (2 changes)v0.1PHP &gt;=7.1

v1.0.0PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/20fbc1e64ffeb6456030e392c1f59eb47a5e9dbb4406aa117ce2a343a4c9f1ba?d=identicon)[maksa988](/maintainers/maksa988)

---

Top Contributors

[![maksa988](https://avatars.githubusercontent.com/u/5982466?v=4)](https://github.com/maksa988 "maksa988 (5 commits)")[![krl-smirnov](https://avatars.githubusercontent.com/u/66352859?v=4)](https://github.com/krl-smirnov "krl-smirnov (1 commits)")[![Oleksandr-Moik](https://avatars.githubusercontent.com/u/50796878?v=4)](https://github.com/Oleksandr-Moik "Oleksandr-Moik (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/maksa988-laravel-wayforpay/health.svg)

```
[![Health](https://phpackages.com/badges/maksa988-laravel-wayforpay/health.svg)](https://phpackages.com/packages/maksa988-laravel-wayforpay)
```

###  Alternatives

[sebdesign/laravel-viva-payments

A Laravel package for integrating the Viva Payments gateway

4845.9k](/packages/sebdesign-laravel-viva-payments)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)[karson/mpesa-php-sdk

172.2k](/packages/karson-mpesa-php-sdk)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[henryejemuta/laravel-monnify

A laravel package to seamlessly integrate monnify api within your laravel application

132.1k](/packages/henryejemuta-laravel-monnify)

PHPackages © 2026

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