andylibrian / omnipay-veritrans
Omnipay PHP支付处理库的Veritrans驱动程序
v1.0.0
2015-02-18 13:12 UTC
Requires
- omnipay/common: ~2.0
Requires (Dev)
- omnipay/tests: ~2.0
- squizlabs/php_codesniffer: ~1.4
This package is not auto-updated.
Last update: 2024-09-14 17:37:16 UTC
README
Veritrans 是Omnipay PHP支付处理库的驱动程序
Omnipay 是一个与框架无关、支持多网关的PHP 5.3+支付处理库。此包实现了Omnipay对Veritrans的支持。
这是一个由作者和社区维护的第三方包。如果您想在Omnipay之外使用Veritrans支付API,我们建议您查看官方的Veritrans支付API PHP封装。
安装
Omnipay通过Composer安装。要安装,只需运行
$ php composer.phar require andylibrian/omnipay-veritrans
基本用法
此包提供了以下网关
- VT-Web
<?php require_once __DIR__ . '/vendor/autoload.php'; use Omnipay\Omnipay; use Omnipay\Common\CreditCard; $gateway = Omnipay::create('Veritrans_VTWeb'); $gateway->setServerKey('server-key-replace-with-yours'); $gateway->setEnvironment('sandbox'); // [production|sandbox] default to production $data = array( 'transactionId' => '123456', 'amount' => '145000.00', 'card' => new CreditCard(), 'vtwebConfiguration' => array( 'credit_card_3d_secure' => true, ), 'currency' => 'IDR', ); $response = $gateway->purchase($data)->send(); if ($response->isSuccessful()) { // payment success, update database // using VT-Web, you will always get redirected to offsite (veritrans page) // so here won't be reached. } elseif ($response->isRedirect()) { // redirect to offsite payment gateway $response->redirect(); } else { echo $response->getMessage(); }
有关一般用法说明,请参阅主要的Omnipay仓库。有关Veritrans功能的更多信息,请参阅Veritrans文档
支持
如果您遇到与Omnipay相关的一般问题,我们建议在Stack Overflow上发帖。请确保添加omnipay标签,以便更容易找到。
如果您想了解发布公告,讨论项目想法或提出更详细的问题,还有一个邮件列表,您可以订阅它。
如果您认为您已发现一个错误,请使用GitHub问题跟踪器报告,或者更好的是,分支库并提交一个pull请求。