PHPackages                             mlocati/payway - 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. mlocati/payway

ActiveLibrary[Payment Processing](/categories/payments)

mlocati/payway
==============

Unofficial BCC PayWay (IGFS Buy Now) client library for PHP

1.0.0(3y ago)235211MITPHPPHP &gt;= 5.5

Since Jun 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mlocati/PayWay)[ Packagist](https://packagist.org/packages/mlocati/payway)[ RSS](/packages/mlocati-payway/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (2)Versions (5)Used By (1)

[![Tests](https://github.com/mlocati/PayWay/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/mlocati/PayWay/actions/workflows/test.yml)[![Coverage](https://camo.githubusercontent.com/2e9be0fb460715fedbb20cdc93b71c77a55e34cb64f087439d2c2c171008c34e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d6c6f636174692f5061795761792f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/mlocati/PayWay?branch=main)

MLocati's unofficial BCC PayWay (IGFS Buy Now) client library for PHP
=====================================================================

[](#mlocatis-unofficial-bcc-payway-igfs-buy-now-client-library-for-php)

This unofficial PHP library can help you accepting payments using the BCC (Banca di Credito Cooperativo) PayWay, which is a service powered by the IGFS (Internet Gateway Financial Systems) Buy Now service.

It supports any PHP version, ranging from PHP 5.5 to the most recent PHP versions (8.2 as for now).

Sample usage to receive a payment
---------------------------------

[](#sample-usage-to-receive-a-payment)

### Initialization

[](#initialization)

If you want to accept a payment for 123.45 € from customers, you first need to initialize the process:

```
use MLocati\PayWay\Init\Request;
use MLocati\PayWay\Dictionary\TrType;
use MLocati\PayWay\Dictionary\Currency;
use MLocati\PayWay\Dictionary\Language;

$request = new Request();
$request
    // Set your terminal ID
    ->setTID('YourTerminalID')
    // Set an unique identifier (of your choiche) of the transaction
    ->setShopID('Order987Attempt1')
    // Set your customer's email address (a notification email will be sent to this address)
    ->setShopUserRef('customer@email.com')
    // The user have to pay, without any back office authorization
    ->setTrType(TrType::CODE_PURCHASE)
    // You can also call setAmountAsCents(12345), which accepts integer numbers instead of floating point numbers
    ->setAmountAsFloat(123.45)
    // Set the currency: for the list of available currencies, use Currency::getDictionary()
    ->setCurrencyCode(Currency::CODE_EUR)
    // Set the language to be displayed to the customer when filling-in the data: for the list of available language, use Language::getDictionary()
    ->setLangID(Language::CODE_ITALIAN)
    // The page where the customer will be redirected to once your customer will have paid
    ->setNotifyURL('https://your.domain/process-completed?shopID=Order987Attempt1')
    // A page to be called in case of technical issues (please remark that if the transaction failed, the customer will be still redirected to the notifyURL page)
    ->setErrorURL('https://your.domain/whoops')
    // An optional page for Server2Server calls: it will receive a POST request with the transaction details
    ->setCallbackURL('https://your.domain/process-completed')
;
```

Next, you have to send the initialization request to your bank's web server:

```
use MLocati\PayWay\Client;
use MLocati\PayWay\Dictionary\RC;

$client = new Client(
    'https://your.bank.com/UNI_CG_SERVICES/services',
    'Your kSig digital signature'        //this is the number you receive from the Bank upon activation
);

$response = $client->init($request);

if ($response->getRc() !== RC::TRANSACTION_OK || $response->isError() || $response->getRedirectURL() === '') {
    throw new \Exception('Transaction failed: ' . $response->getErrorDesc());
}
```

At this point, you you have a succesfull initialization response. You have to store the result of `$response->getPaymentID()` for later usage (for example, in a database table).

### Customer interaction

[](#customer-interaction)

Now you can redirect your customers to the external payment page:

```
header('Location: ' . $response->getRedirectURL());
```

At the resulting page, the customers will fulfill a form with their credit card data.

### Verify the ransaction result

[](#verify-the-ransaction-result)

Once the customers completed the payment (or canceled it), they will return to your website, at the page specified in the notify URL.

In the notify URL page, you then have to check the result of the payment transaction.

You may want to use something like this:

```
use MLocati\PayWay\Verify\Request;
use MLocati\PayWay\Dictionary\RC;

$shopID = isset($_GET['shopID']) && is_string($_GET['shopID']) ? $_GET['shopID'] : '';
$paymentID = retrieveStoredPaymentID($shopID);
if ($paymentID === '') {
    throw new \Exception('Unexpected shopID parameter');
}
$request = new Request();
$request
    // Set your terminal ID
    ->setTID('YourTerminalID')
    // Set the unique identifier of the transaction
    ->setShopID($shopID)
    // Set the remote server-assigned payment ID
    ->setPaymentID($paymentID)
;

//Connect to the bank again
$client = new Client(
    'https://your.bank.com/UNI_CG_SERVICES/services',
    'Your kSig digital signature'        //this is the number you receive from the Bank upon activation
);

$response = $client->verify($request);

if ($response->getRc() !== RC::TRANSACTION_OK || $response->isError()) {
    throw new \Exception('Transaction failed: ' . $response->getErrorDesc());
}
```

Server2Server communication (callback URL)
------------------------------------------

[](#server2server-communication-callback-url)

If in the initialization process you configured the callback URL, you can check the received parameters by using some code like this:

```
use MLocati\PayWay\Server2Server\RequestData;

$request = Server2Server\RequestData::createFromGlobals();
```

And you can inspect what `$request` contains to verify the transaction result (same process as above).

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.9% 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

4

Last Release

1114d ago

Major Versions

0.0.3 → 1.0.02023-06-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e9d7ece045fc89575e083ee4852edf31218df403c84f41a0de01863dae982f5?d=identicon)[mlocati](/maintainers/mlocati)

---

Top Contributors

[![mlocati](https://avatars.githubusercontent.com/u/928116?v=4)](https://github.com/mlocati "mlocati (13 commits)")[![impronta48](https://avatars.githubusercontent.com/u/5368022?v=4)](https://github.com/impronta48 "impronta48 (1 commits)")

---

Tags

paywayigfsbccbuy nowbanca di credito cooperativobanche di credito cooperativo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mlocati-payway/health.svg)

```
[![Health](https://phpackages.com/badges/mlocati-payway/health.svg)](https://phpackages.com/packages/mlocati-payway)
```

###  Alternatives

[enupal/stripe

Allows customers sign up for recurring and one-time payments with Stripe, perfect for orders, donations, subscriptions, and events. Create simple payment forms in seconds easily without coding. For Craft CMS 3.x

3416.6k1](/packages/enupal-stripe)[msilabs/bkash

bKash Payment Gateway API for Laravel Framework.

181.2k](/packages/msilabs-bkash)

PHPackages © 2026

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