tcgunel/omnipay-akbank
Composer 安装命令:
composer require tcgunel/omnipay-akbank
包简介
Omnipay extension for Akbank Virtual POS
README 文档
README
Akbank Virtual POS driver for the Omnipay PHP payment processing library
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
composer require tcgunel/omnipay-akbank
Requirements
- PHP >= 8.0
- ext-json
Usage
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)
$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
$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)
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)
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)
$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
$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
Transaction Codes
| Code | Operation |
|---|---|
| 1000 | Sale (Non-3D) |
| 3000 | Sale (3D Secure) |
| 1002 | Refund |
| 1003 | Cancel (Void) |
Endpoints
| Environment | API URL |
|---|---|
| Test 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
- Each API request includes HMAC-SHA512 hash of the JSON body as the
auth-hashheader - 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 | Code |
|---|---|
| TRY | 949 |
| USD | 840 |
| EUR | 978 |
| GBP | 826 |
| JPY | 392 |
Testing
composer test
License
The MIT License (MIT). Please see License File for more information.
tcgunel/omnipay-akbank 适用场景与选型建议
tcgunel/omnipay-akbank 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「gateway」 「omnipay」 「akbank」 「3d secure」 「virtual pos」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tcgunel/omnipay-akbank 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tcgunel/omnipay-akbank 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tcgunel/omnipay-akbank 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
Payyo Gateway for the Omnipay payment processing library
Yandex.Kassa driver for Omnipay payment processing library
Some pre-defined rules for validation in Omnipay payment processing library.
BluePay gateway for the Omnipay payment processing library
Client library to send SMS using Comilio SMS Gateway API (https://www.comilio.it)
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-23