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

ActiveLibrary[Payment Processing](/categories/payments)

sonix/laravel-wayforpay
=======================

WayForPay payments for Laravel

044PHP

Since Jan 10Pushed 3y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

This repository is a fork from original , i decided to fork and work independent because the original one was not being updated for long time and keep doing support for the application.

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

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

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;= 8.0.2

[](#laravel--802)

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

[](#installation)

Require this package with composer.

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

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

```
Sonix\WayForPay\WayForPayServiceProvider::class,
```

Add the `WayForPay` facade to your facades array:

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

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

```
php artisan vendor:publish --provider="Sonix\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 \Sonix\WayForPay\Domain\Client('John', 'Doe', 'johndoe@gmail.com');
$products = new \Sonix\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 \Sonix\WayForPay\Domain\Card('5276999765600381', '05', '2021', '237', 'JOHN DOU');
$cardToken = new \Sonix\WayForPay\Domain\Card('1aa11aaa-1111-11aa-a1a1-0000a00a00aa');
```

You can use `\Sonix\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)

- [Sonix](https://github.com/YasMax91)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c6e6448fbf951b8aa1a752e7ece93285497cbf0775dd3590ec4364a7835b6833?d=identicon)[YasMax91](/maintainers/YasMax91)

---

Top Contributors

[![YasMax91](https://avatars.githubusercontent.com/u/49555585?v=4)](https://github.com/YasMax91 "YasMax91 (2 commits)")

### Embed Badge

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

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

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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