sudiptpa/omnipay-nabtransact
Composer 安装命令:
composer require sudiptpa/omnipay-nabtransact
包简介
National Australia Bank (NAB) Transact driver for the Omnipay payment processing library.
README 文档
README
NAB Transact driver for the Omnipay PHP payment processing library
If this package has been useful to you, GitHub Sponsors is a simple way to support ongoing maintenance, improvements, and future releases.
Omnipay is a framework agnostic, multi-gateway payment processing library for PHP. This package implements NAB Transact support for Omnipay.
Compatibility
- PHP
^7.2 || ^8.0 omnipay/common:^3
Installation
Omnipay is installed via Composer. To install, simply require league/omnipay and sudiptpa/omnipay-nabtransact with Composer:
composer require league/omnipay sudiptpa/omnipay-nabtransact
Start Here: Choose the Right Integration Flow
- SecureXML (server-to-server):
- Use
NABTransact_SecureXML - Main methods:
authorize(),purchase(),capture(),refund(),echoTest()
- Use
- DirectPost (redirect + callback):
- Use
NABTransact_DirectPost - Start methods:
purchase()orauthorize() - Callback methods:
completePurchase(),completeAuthorize()
- Use
- DirectPost operations API (server-to-server):
- Use
capture(),refund(),void(),store(),createEMV3DSOrder()
- Use
- Hosted Payment Page:
- Use
NABTransact_HostedPayment - Methods:
purchase(),completePurchase()
- Use
- UnionPay:
- Use
NABTransact_UnionPay - Methods:
purchase(),completePurchase()
- Use
Basic Usage
The following gateways are provided by this package:
- NABTransact_DirectPost (NAB Transact Direct Post v2)
- NABTransact_SecureXML (NAB Transact SecurePay XML)
- NABTransact_HostedPayment (NAB Hosted Payment Page)
- NABTransact_UnionPay (UnionPay via NAB Transact)
NAB Transact SecureXML API
use Omnipay\Omnipay; use Omnipay\Common\CreditCard; $gateway = Omnipay::create('NABTransact_SecureXML'); $gateway->setMerchantId('XYZ0010'); $gateway->setTransactionPassword('abcd1234'); $gateway->setTestMode(true); $card = new CreditCard([ 'firstName' => 'Sujip', 'lastName' => 'Thapa', 'number' => '4444333322221111', 'expiryMonth' => '06', 'expiryYear' => '2030', 'cvv' => '123', ] ); $transaction = $gateway->purchase([ 'amount' => '10.00', 'currency' => 'AUD', 'transactionId' => 'XYZ100', 'card' => $card, ] ); $response = $transaction->send(); if ($response->isSuccessful()) { echo sprintf('Transaction %s was successful!', $response->getTransactionReference()); } else { echo sprintf('Transaction %s failed: %s', $response->getTransactionReference(), $response->getMessage()); }
NAB Transact SecureXML API with Risk Management
use Omnipay\Omnipay; use Omnipay\Common\CreditCard; $gateway = Omnipay::create('NABTransact_SecureXML'); $gateway->setMerchantId('XYZ0010'); $gateway->setTransactionPassword('abcd1234'); $gateway->setTestMode(true); $gateway->setRiskManagement(true); $card = new CreditCard([ 'firstName' => 'Sujip', 'lastName' => 'Thapa', 'number' => '4444333322221111', 'expiryMonth' => '06', 'expiryYear' => '2030', 'cvv' => '123', ] ); $transaction = $gateway->purchase([ 'amount' => '10.00', 'currency' => 'AUD', 'transactionId' => 'XYZ100', 'card' => $card, 'ip' => '1.1.1.1', ] ); $response = $transaction->send(); if ($response->isSuccessful()) { echo sprintf('Transaction %s was successful!', $response->getTransactionReference()); } else { echo sprintf('Transaction %s failed: %s', $response->getTransactionReference(), $response->getMessage()); }
NAB Transact DirectPost v2
$gateway = Omnipay::create('NABTransact_DirectPost'); $gateway->setMerchantId('XYZ0010'); $gateway->setTransactionPassword('abcd1234'); $gateway->setTestMode(true); $gateway->setHasEMV3DSEnabled(true); $card = new CreditCard([ 'firstName' => 'Sujip', 'lastName' => 'Thapa', 'number' => '4444333322221111', 'expiryMonth' => '10', 'expiryYear' => '2030', 'cvv' => '123', ]); $response = $gateway->purchase([ 'amount' => '12.00', 'transactionId' => 'ORDER-ZYX8', 'transactionReference' => '11fc42b0-bb7a-41a4-8b3c-096b3fd4d402', 'currency' => 'AUD', 'card' => $card, 'clientIp' => '192.168.1.1' ]) ->send(); if ($response->isRedirect()) { $response->redirect(); } if ($response->isSuccessful()) { echo sprintf('Transaction %s was successful!', $response->getTransactionReference()); } else { echo sprintf('Transaction %s failed: %s', $response->getTransactionReference(), $response->getMessage()); }
DirectPost Store Only
$gateway = Omnipay::create('NABTransact_DirectPost'); $gateway->setMerchantId('XYZ0010'); $gateway->setTransactionPassword('abcd1234'); $gateway->setTestMode(true); $response = $gateway->store([ 'transactionId' => 'STORE-ORDER-100', 'returnUrl' => 'http://example.com/payment/response', 'card' => $card, ])->send(); if ($response->isRedirect()) { $response->redirect(); }
DirectPost Capture (Complete Preauth, Server-to-Server)
$gateway = Omnipay::create('NABTransact_DirectPost'); $gateway->setMerchantId('XYZ0010'); $gateway->setTransactionPassword('abcd1234'); $gateway->setTestMode(true); $response = $gateway->capture([ 'transactionId' => 'CAPTURE-ORDER-100', 'transactionReference' => 'NAB-ORIGINAL-TXN-ID', 'amount' => '12.00', 'currency' => 'AUD', ])->send(); if ($response->isSuccessful()) { echo 'Capture successful: '.$response->getTransactionReference(); }
DirectPost Refund (Server-to-Server)
$response = $gateway->refund([ 'transactionId' => 'REFUND-ORDER-100', 'transactionReference' => 'NAB-SETTLED-TXN-ID', 'amount' => '5.00', 'currency' => 'AUD', ])->send();
DirectPost Reversal/Void (Server-to-Server)
$response = $gateway->void([ 'transactionId' => 'VOID-ORDER-100', 'transactionReference' => 'NAB-AUTH-TXN-ID', 'amount' => '12.00', ])->send();
EMV 3DS Order Creation API
$response = $gateway->createEMV3DSOrder([ 'amount' => '12.00', 'currency' => 'AUD', 'clientIp' => '203.0.113.10', 'transactionReference' => 'ORDER-REF-100', ])->send(); if ($response->isSuccessful()) { echo 'Order ID: '.$response->getOrderId(); echo 'Simple Token: '.$response->getSimpleToken(); }
DirectPost Advanced Optional Parameters
$response = $gateway->purchase([ 'amount' => '112.00', 'currency' => 'AUD', 'transactionId' => 'ORDER-ADV-100', 'card' => $card, 'returnUrl' => 'https://example.com/payment/response', 'notifyUrl' => 'https://example.com/payment/callback', // Optional reporting/callback field control 'resultParams' => 'merchant,refid,rescode,restext', 'callbackParams' => 'merchant,refid,rescode,restext', // Optional surcharge reporting fields 'surchargeEnabled' => true, 'surchargeAmount' => '12.00', 'surchargeRate' => '5.00', 'surchargeFee' => '7.00', // Optional MCR route hint 'cardScheme' => 'scheme', // or 'eftpos' ])->send();
NAB Transact DirectPost v2 UnionPay Online Payment
$gateway = Omnipay::create('NABTransact_UnionPay'); $gateway->setMerchantId('XYZ0010'); $gateway->setTransactionPassword('abcd1234'); $gateway->setTestMode(true); /* * The parameter transactionId must be alpha-numeric and 8 to 32 characters in length */ $response = $gateway->purchase([ 'amount' => '12.00', 'transactionId' => '1234566789205067', 'currency' => 'AUD', 'returnUrl' => 'http://example.com/payment/response', ]) ->send(); if ($response->isRedirect()) { $response->redirect(); }
Complete Purchase
$gateway = Omnipay::create('NABTransact_UnionPay'); $gateway->setMerchantId('XYZ0010'); $gateway->setTransactionPassword('abcd1234'); $gateway->setTestMode(true); $response = $gateway->completePurchase([ 'amount' => '12.00', 'transactionId' => '1234566789205067', 'transactionReference' => '11fc42b0-bb7a-41a4-8b3c-096b3fd4d402', 'currency' => 'AUD', 'returnUrl' => 'http://example.com/payment/response', ]) ->send(); if ($response->isSuccessful()) { echo sprintf('Transaction %s was successful!', $response->getTransactionReference()); } else { echo sprintf('Transaction %s failed: %s', $response->getTransactionReference(), $response->getMessage()); }
For general usage instructions, please see the main Omnipay repository.
Framework-Agnostic Transport Option
Omnipay support remains the default behavior. SecureXML requests can now also use a framework-agnostic cURL transport:
use Omnipay\NABTransact\Transport\CurlTransport; $request = $gateway->purchase([ 'amount' => '10.00', 'transactionId' => 'ORDER-1000', 'card' => $card, ]); $request->setTransport(new CurlTransport()); $response = $request->send();
DirectPost server-to-server operations (capture, refund, void, createEMV3DSOrder) can use the same transport injection pattern.
See ARCHITECTURE.md for design details and extension points.
NAB Feature Coverage
Core payment features are mapped in docs/feature-matrix.md with request/response classes and test coverage.
For a contributor-friendly package map, see docs/features-implemented-tree.md.
This package targets payment-processing API coverage and does not include NAB admin/reporting portal features.
Documentation Map
README.md: install + practical flow examplesARCHITECTURE.md: project structure, runtime flow, extension pointsdocs/feature-matrix.md: feature-by-feature status mapdocs/features-implemented-tree.md: full implementation tree
Contributing
Contributions are welcome and will be fully credited.
Contributions can be made via a Pull Request on Github.
Support
If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.
If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.
If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.
Architecture
See ARCHITECTURE.md for package structure, flow, and extension points.
sudiptpa/omnipay-nabtransact 适用场景与选型建议
sudiptpa/omnipay-nabtransact 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 19.24k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2016 年 11 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「pay」 「gateway」 「merchant」 「omnipay」 「nabtransact」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sudiptpa/omnipay-nabtransact 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sudiptpa/omnipay-nabtransact 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sudiptpa/omnipay-nabtransact 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
Payyo Gateway for the Omnipay payment processing library
Библиотека для приема платежей через Альфабанк.
Some pre-defined rules for validation in Omnipay payment processing library.
BluePay gateway for the Omnipay payment processing library
支付宝接口扩展包
统计信息
- 总下载量: 19.24k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 40
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-20