PHPackages                             tcgunel/omnipay-qnbfinansbank - 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. tcgunel/omnipay-qnbfinansbank

ActiveLibrary[Payment Processing](/categories/payments)

tcgunel/omnipay-qnbfinansbank
=============================

Omnipay extension for QNB Finansbank

v2.1.0(1mo ago)05MITPHPPHP ^8.3CI failing

Since Mar 23Pushed 1mo agoCompare

[ Source](https://github.com/tcgunel/omnipay-qnbfinansbank)[ Packagist](https://packagist.org/packages/tcgunel/omnipay-qnbfinansbank)[ Docs](https://github.com/tcgunel/omnipay-qnbfinansbank)[ RSS](/packages/tcgunel-omnipay-qnbfinansbank/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (16)Versions (4)Used By (0)

Omnipay: QNB Finansbank
=======================

[](#omnipay-qnb-finansbank)

**QNB Finansbank sanal pos gateway for the Omnipay PHP payment processing library**

[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP. This package implements QNB Finansbank support for Omnipay.

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

[](#installation)

```
composer require tcgunel/omnipay-qnbfinansbank
```

Available Methods
-----------------

[](#available-methods)

MethodDescription`purchase()`Direct (non-3D) sale or 3D Secure redirect`completePurchase()`Complete 3D Secure payment after bank callback (with response-hash verification)`void()`Cancel/void a transaction`refund()`Refund a transaction (full or partial)`transactionQuery()`Order inquiry — query the bank-side status of an orderSupported Features
------------------

[](#supported-features)

FeatureSupported3D SecureYesNon-3D (direct)YesCancel (void)YesRefundYesOrder inquiry (payment status)YesBIN lookupNo (not offered by the QNB VPos API)Installment queryNo (not offered by the QNB VPos API)Usage
-----

[](#usage)

### Gateway Initialization

[](#gateway-initialization)

```
use Omnipay\Omnipay;

$gateway = Omnipay::create('QnbFinansbank');

$gateway->setMerchantId('your_merchant_id');
$gateway->setMerchantUser('your_user_code');
$gateway->setMerchantPassword('your_user_password');
$gateway->setMerchantStorekey('your_store_key'); // Required for 3D Secure
$gateway->setTestMode(true); // Use test endpoint
```

### Non-3D Purchase (Direct Sale)

[](#non-3d-purchase-direct-sale)

```
$response = $gateway->purchase([
    'amount'      => '100.00',
    'currency'    => 'TRY',
    'transactionId' => 'ORDER-12345',
    'secure'      => false,
    'card'        => [
        'number'      => '4508034508034509',
        'expiryMonth' => '12',
        'expiryYear'  => '2030',
        'cvv'         => '000',
    ],
])->send();

if ($response->isSuccessful()) {
    echo 'Transaction ID: ' . $response->getTransactionReference();
} else {
    echo 'Error: ' . $response->getMessage();
}
```

### 3D Secure Purchase

[](#3d-secure-purchase)

```
$response = $gateway->purchase([
    'amount'      => '100.00',
    'currency'    => 'TRY',
    'transactionId' => 'ORDER-12345',
    'secure'      => true,
    'returnUrl'   => 'https://yoursite.com/payment/success',
    'cancelUrl'   => 'https://yoursite.com/payment/fail',
    'card'        => [
        'number'      => '4508034508034509',
        'expiryMonth' => '12',
        'expiryYear'  => '2030',
        'cvv'         => '000',
    ],
])->send();

if ($response->isRedirect()) {
    $response->redirect(); // POSTs card data to the bank 3D Secure page
}
```

### Complete 3D Secure Purchase (Callback Handler)

[](#complete-3d-secure-purchase-callback-handler)

After the bank posts back to your `returnUrl`:

```
$response = $gateway->completePurchase([])->send();

if ($response->isSuccessful()) {
    echo 'Payment confirmed! Transaction: ' . $response->getTransactionReference();
} else {
    echo 'Payment failed: ' . $response->getMessage();
}
```

The full callback POST payload is read directly from `$_POST` by the request. `completePurchase()` is successful only when `ProcReturnCode` is `00` **and** the QNB response hash verifies — see [Response Hash Verification](#response-hash-verification).

### Void (Cancel)

[](#void-cancel)

```
$response = $gateway->void([
    'orderNumber' => 'ORDER-12345',
    'currency'    => 'TRY',
])->send();

if ($response->isSuccessful()) {
    echo 'Transaction voided.';
} else {
    echo 'Error: ' . $response->getMessage();
}
```

### Refund

[](#refund)

```
$response = $gateway->refund([
    'orderNumber' => 'ORDER-12345',
    'amount'      => '50.00',
    'currency'    => 'TRY',
])->send();

if ($response->isSuccessful()) {
    echo 'Refund processed.';
} else {
    echo 'Error: ' . $response->getMessage();
}
```

### Order Inquiry (Payment Status)

[](#order-inquiry-payment-status)

Query the current bank-side status of an order — useful for reconciliation when a 3D callback is never received:

```
$response = $gateway->transactionQuery([
    'transactionId' => 'ORDER-12345',
    'currency'      => 'TRY',
])->send();

if ($response->isSuccessful()) {
    echo 'Order found at the bank.';
    echo $response->isVoided()   ? ' (voided)'   : '';
    echo $response->isRefunded() ? ' (refunded)' : '';
} else {
    echo 'Not found / failed: ' . $response->getMessage();
}
```

Hash Algorithm
--------------

[](#hash-algorithm)

### Request hash (3D Secure)

[](#request-hash-3d-secure)

```
SHA1Base64(MbrId + OrderId + PurchAmount + OkUrl + FailUrl + TxnType + InstallmentCount + Rnd + MerchantPass)

```

### Response Hash Verification

[](#response-hash-verification)

After a 3D callback, the response hash is checked to confirm it genuinely came from QNB:

```
SHA1Base64(MerchantId + MerchantPass + OrderId + AuthCode + ProcReturnCode + 3DStatus + ResponseRnd + UserCode)

```

`completePurchase()->isSuccessful()` returns `true` only when `ProcReturnCode`is `00` and this hash matches. Verification is skipped (not failed) when no `merchantStorekey` is configured or the bank returns no `ResponseHash`, so a genuine payment is never rejected purely because the key is missing.

**Note:** `MbrId` is always `5` for QNB Finansbank. `MerchantPass` is the 3D Secure store key (`merchantStorekey`); it is only used for hashing and is never transmitted in a request.

Endpoints
---------

[](#endpoints)

EnvironmentURLTest`https://vpostest.qnb.com.tr/Gateway/Default.aspx`Production`https://vpos.qnb.com.tr/Gateway/Default.aspx`Key Differences from Denizbank
------------------------------

[](#key-differences-from-denizbank)

- Uses `MbrId: 5` field in all requests
- Uses `ErrMsg` instead of `ErrorMessage` for error messages
- Different endpoint URLs (`vpos.qnb.com.tr` vs `inter-vpos.com.tr`)

Running Tests
-------------

[](#running-tests)

```
composer test
```

Static Analysis
---------------

[](#static-analysis)

```
composer analyse
```

Code Style
----------

[](#code-style)

```
composer lint
```

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance93

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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 ~30 days

Total

3

Last Release

36d ago

Major Versions

v1.0.0 → v2.0.02026-03-23

PHP version history (2 changes)v1.0.0PHP ^8.0

v2.0.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/36dffe883e88aeef07c26067af3d6a7eda1c2a81f1ae45fdd430b721665131da?d=identicon)[Mobius Studio](/maintainers/Mobius%20Studio)

---

Top Contributors

[![tcgunel](https://avatars.githubusercontent.com/u/3923425?v=4)](https://github.com/tcgunel "tcgunel (6 commits)")

---

Tags

paymentgatewayomnipaysanal-pos3d-securefinansbankQNB Finansbankqnbfinansbank

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tcgunel-omnipay-qnbfinansbank/health.svg)

```
[![Health](https://phpackages.com/badges/tcgunel-omnipay-qnbfinansbank/health.svg)](https://phpackages.com/packages/tcgunel-omnipay-qnbfinansbank)
```

PHPackages © 2026

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