tcgunel/omnipay-paynet
Composer 安装命令:
composer require tcgunel/omnipay-paynet
包简介
Omnipay extension for Paynet
README 文档
README
Omnipay Paynet Gateway
Omnipay gateway for Paynet - REST JSON API. All available methods of Paynet implemented for easy usage.
Requirements
| PHP | Package |
|---|---|
| ^8.0 | v1.0.0 |
Installation
composer require tcgunel/omnipay-paynet
Usage
Gateway Initialization
use Omnipay\Omnipay; $gateway = Omnipay::create('Paynet'); $gateway->setSecretKey('YOUR_BASE64_ENCODED_SECRET_KEY'); $gateway->setTestMode(true); // Use test environment
Authentication
Paynet uses Basic Authentication with a base64-encoded secret key. Set this via setSecretKey().
- Test URL:
https://pts-api.paynet.com.tr - Live URL:
https://api.paynet.com.tr
Methods
Payment Services
Direct Sale (Non-3D)
$response = $gateway->purchase([ 'amount' => '150.00', 'transactionId' => 'ORDER-12345', 'installment' => 1, 'card' => [ 'firstName' => 'Test', 'lastName' => 'User', 'number' => '4155650100416111', 'expiryMonth' => '01', 'expiryYear' => '2030', 'cvv' => '123', 'email' => 'test@example.com', 'phone' => '5551234567', ], ])->send(); if ($response->isSuccessful()) { $transactionRef = $response->getTransactionReference(); // xact_id }
3D Secure Sale
// Step 1: Initiate 3D Secure $response = $gateway->purchase3d([ 'amount' => '250.00', 'transactionId' => 'ORDER-3D-12345', 'installment' => 3, 'returnUrl' => 'https://example.com/payment/callback', 'card' => [ 'firstName' => 'Test', 'lastName' => 'User', 'number' => '4155650100416111', 'expiryMonth' => '01', 'expiryYear' => '2030', 'cvv' => '123', 'email' => 'test@example.com', 'phone' => '5551234567', ], ])->send(); if ($response->isRedirect()) { $htmlContent = $response->getHtmlContent(); // Render $htmlContent to redirect user to 3D Secure page }
// Step 2: Complete 3D Secure (after callback) $response = $gateway->completePurchase([ 'sessionId' => $_POST['session_id'], 'tokenId' => $_POST['token_id'], ])->send(); if ($response->isSuccessful()) { $transactionRef = $response->getTransactionReference(); // xact_id $orderNumber = $response->getTransactionId(); // reference_no }
Cancel (Void)
$response = $gateway->void([ 'xactId' => 'PAY-TXN-00001', ])->send(); if ($response->isSuccessful()) { echo $response->getMessage(); }
Refund
$response = $gateway->refund([ 'xactId' => 'PAY-TXN-00001', 'amount' => '50.00', ])->send(); if ($response->isSuccessful()) { echo $response->getMessage(); }
Query Services
Installment Query (BIN Based)
$response = $gateway->installmentQuery([ 'bin' => '415565', 'amount' => '100.00', 'addCommission' => true, ])->send(); if ($response->isSuccessful()) { $installments = $response->getInstallments(); $bankInfo = $response->getBankInfo(); $tdsRequired = $response->isTdsRequired(); foreach ($installments as $inst) { echo "Taksit: {$inst['instalment']}, Toplam: {$inst['total_amount']}\n"; } }
API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| purchase | /v2/transaction/payment | Direct (non-3D) sale |
| purchase3d | /v2/transaction/tds_initial | 3D Secure sale initiation |
| completePurchase | /v2/transaction/tds_charge | Complete 3D Secure payment |
| void | /v1/transaction/reversed_request | Cancel (void) a transaction |
| refund | /v1/transaction/reversed_request | Refund a transaction |
| installmentQuery | /v1/ratio/Get | Query installment rates by BIN |
Test Credentials
Contact Paynet for sandbox credentials. Test environment is available at https://pts-api.paynet.com.tr.
Set testMode to true to use the test environment:
$gateway->setTestMode(true);
Tests
composer test
For Windows:
vendor\bin\paratest.bat
License
MIT
tcgunel/omnipay-paynet 适用场景与选型建议
tcgunel/omnipay-paynet 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「gateway」 「omnipay」 「3d secure」 「sanal pos」 「paynet」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tcgunel/omnipay-paynet 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tcgunel/omnipay-paynet 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tcgunel/omnipay-paynet 相关的其它包
同方向 / 同关键字的高下载量 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)
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-23