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

ActiveLibrary[Payment Processing](/categories/payments)

tcgunel/omnipay-akbank
======================

Omnipay extension for Akbank Virtual POS

v2.0.0(3mo ago)02MITPHPPHP ^8.3CI passing

Since Mar 23Pushed 3mo agoCompare

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

READMEChangelogDependencies (7)Versions (3)Used By (0)

Omnipay: Akbank
===============

[](#omnipay-akbank)

**Akbank Virtual POS driver for the Omnipay PHP payment processing library**

[![Latest Stable Version](https://camo.githubusercontent.com/b6dfd47406ea4531acd3f6bd28abedfc158dc9a6d820fe6f5f5afe9af7843054/68747470733a2f2f706f7365722e707567782e6f72672f746367756e656c2f6f6d6e697061792d616b62616e6b2f76)](https://packagist.org/packages/tcgunel/omnipay-akbank)[![Total Downloads](https://camo.githubusercontent.com/2af34acbe30fffe9c718af14695966fee153be6fe91c3c75d57f60aa7cc9d15b/68747470733a2f2f706f7365722e707567782e6f72672f746367756e656c2f6f6d6e697061792d616b62616e6b2f646f776e6c6f616473)](https://packagist.org/packages/tcgunel/omnipay-akbank)[![License](https://camo.githubusercontent.com/ed9580c42605755d8e0c68a8eef7f1496827b23e604724ce58d394a933369bfa/68747470733a2f2f706f7365722e707567782e6f72672f746367756e656c2f6f6d6e697061792d616b62616e6b2f6c6963656e7365)](https://packagist.org/packages/tcgunel/omnipay-akbank)

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

Akbank uses a modern REST JSON API with HMAC-SHA512 request signing.

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

[](#installation)

```
composer require tcgunel/omnipay-akbank
```

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0
- ext-json

Usage
-----

[](#usage)

### Gateway Initialization

[](#gateway-initialization)

```
use Omnipay\Omnipay;

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

$gateway->setMerchantSafeId('your-merchant-safe-id');
$gateway->setTerminalSafeId('your-terminal-safe-id');
$gateway->setSecretKey('your-secret-key');
$gateway->setTestMode(true); // Use test endpoints
```

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

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

```
$response = $gateway->purchase([
    'amount'        => '100.00',
    'currency'      => 'TRY',
    'transactionId' => 'ORDER-001',
    'clientIp'      => '127.0.0.1',
    'installment'   => 1,
    'secure'        => false,
    'card'          => [
        'firstName'   => 'John',
        'lastName'    => 'Doe',
        'number'      => '5218076007402834',
        'expiryMonth' => '12',
        'expiryYear'  => '2030',
        'cvv'         => '000',
    ],
])->send();

if ($response->isSuccessful()) {
    echo 'Payment successful! Auth Code: ' . $response->getTransactionReference();
} else {
    echo 'Payment failed: ' . $response->getMessage();
    echo ' Code: ' . $response->getCode();
}
```

### 3D Secure Payment

[](#3d-secure-payment)

```
$response = $gateway->purchase([
    'amount'        => '100.00',
    'currency'      => 'TRY',
    'transactionId' => 'ORDER-001',
    'clientIp'      => '127.0.0.1',
    'installment'   => 1,
    'secure'        => true,
    'returnUrl'     => 'https://example.com/payment/success',
    'cancelUrl'     => 'https://example.com/payment/failure',
    'card'          => [
        'firstName'   => 'John',
        'lastName'    => 'Doe',
        'number'      => '5218076007402834',
        'expiryMonth' => '12',
        'expiryYear'  => '2030',
        'cvv'         => '000',
    ],
])->send();

if ($response->isRedirect()) {
    $response->redirect(); // Redirects to bank 3D page
}
```

The redirect form is rendered with `target="_top"` so the bank's 3D Secure page escapes any iframe the merchant renders it in (Akbank's 3DS page sends `X-Frame-Options: DENY`).

### 3D Pay Hosting (bank-hosted card page)

[](#3d-pay-hosting-bank-hosted-card-page)

Opt in per request by setting the payment model. In this model the card is collected on Akbank's own page, so **no card data is sent** and there is **no `completePurchase` step** — the bank posts the final result to your `returnUrl`:

```
use Omnipay\Akbank\Constants\PaymentModel;

$response = $gateway->purchase([
    'amount'        => '100.00',
    'currency'      => 'TRY',
    'transactionId' => 'ORDER-001',
    'installment'   => 1,
    'secure'        => true,
    'paymentModel'  => PaymentModel::THREE_D_PAY_HOSTING,
    'emailAddress'  => 'customer@example.com',
    'returnUrl'     => 'https://example.com/payment/success',
    'cancelUrl'     => 'https://example.com/payment/failure',
])->send();

if ($response->isRedirect()) {
    $response->redirect(); // Redirects to bank's hosted payment page
}
```

On the callback, verify the bank's signature and read the final `responseCode` directly:

```
use Omnipay\Akbank\Helpers\Helper;

if (Helper::verifyResponseHash($_POST, 'your-secret-key') && $_POST['responseCode'] === 'VPS-0000') {
    // payment successful
}
```

### Complete 3D Purchase (Callback Handler)

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

After the bank redirects back to your `returnUrl`, complete the purchase:

```
$response = $gateway->completePurchase([
    'transactionId' => $_POST['orderId'],
    'amount'        => '100.00',
    'currency'      => 'TRY',
    'clientIp'      => $_SERVER['REMOTE_ADDR'],
    'installment'   => 1,
    'responseCode'  => $_POST['responseCode'],
    'mdStatus'      => $_POST['mdStatus'],
    'secureId'      => $_POST['secureId'],
    'secureEcomInd' => $_POST['secureEcomInd'],
    'secureData'    => $_POST['secureData'],
    'secureMd'      => $_POST['secureMd'],
])->send();

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

### Cancel (Void)

[](#cancel-void)

```
$response = $gateway->void([
    'transactionId' => 'ORDER-001',
    'clientIp'      => '127.0.0.1',
])->send();

if ($response->isSuccessful()) {
    echo 'Transaction cancelled successfully.';
} else {
    echo 'Cancel failed: ' . $response->getMessage();
}
```

### Refund

[](#refund)

```
$response = $gateway->refund([
    'transactionId' => 'ORDER-001',
    'amount'        => '50.00',
    'currency'      => 'TRY',
    'clientIp'      => '127.0.0.1',
])->send();

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

API Details
-----------

[](#api-details)

### Transaction Codes

[](#transaction-codes)

CodeOperation1000Sale (Non-3D)3000Sale (3D Secure)1002Refund1003Cancel (Void)### Endpoints

[](#endpoints)

EnvironmentAPI URLTest API`https://apipre.akbank.com/api/v1/payment/virtualpos/transaction/process`Live API`https://api.akbank.com/api/v1/payment/virtualpos/transaction/process`Test 3D`https://virtualpospaymentgatewaypre.akbank.com/securepay`Live 3D`https://virtualpospaymentgateway.akbank.com/securepay`### Authentication

[](#authentication)

- Each API request includes HMAC-SHA512 hash of the JSON body as the `auth-hash` header
- 3D requests include HMAC-SHA512 hash of concatenated form fields
- All requests include a 128-character random hex number and ISO datetime

### Currency Codes

[](#currency-codes)

CurrencyCodeTRY949USD840EUR978GBP826JPY392Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

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

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance82

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

Total

2

Last Release

96d 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

paymentgatewayomnipayakbanksanal-pos3d-securevirtual-pos

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

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

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

PHPackages © 2026

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