alegra / omnipay-masterpass
Omnipay支付处理库的Masterpass网关
v0.0.31
2021-02-10 14:16 UTC
Requires
- php: ^7.3
- ext-json: *
- ext-openssl: *
- ext-simplexml: *
- ext-soap: *
- omnipay/common: ^3
Requires (Dev)
- omnipay/tests: ^3
- phpro/grumphp: ^0.18
- squizlabs/php_codesniffer: ^3
This package is auto-updated.
Last update: 2024-09-11 13:07:08 UTC
README
Omnipay V3支付处理库的MasterPass国内集成(土耳其)网关Omnipay是一个与框架无关的多网关支付处理库,适用于PHP 7.3+。此软件包实现了Omnipay对MasterPass在线支付网关的支持。
- 您需要联系MasterPass获取文档。
- 您需要macKey、encKey、merchantId。您可以从MasterPass获取它们。
需求
- PHP >= 7.3.x,
- Omnipay V.3仓库,
- PHPUnit以运行测试
自动加载
您必须安装Omnipay V.3
composer require league/omnipay:^3
然后您必须安装omnipay-payu软件包
composer require alegra/omnipay-masterpass
payment-masterpass
遵循PSR-4命名约定,这意味着您可以将payment-masterpass
类轻松集成到自己的自动加载器中。
基本用法
- 您可以使用/examples文件夹中的示例。此文件夹仅用于显示示例,不用于生产使用。
- 在/examples文件夹中首先进行操作
composer install
授权示例
- 您可以在/examples文件夹中查看authorize.php文件。
- 此方法获取令牌。您必须在所有请求中使用令牌
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\Masterpass\Gateway; use Examples\Helper; $gateway = new Gateway(); $helper = new Helper(); try { $params = $helper->getAuthorizeParams(); $response = $gateway->authorize($params)->send(); $result = [ 'status' => $response->isSuccessful() ?: 0, 'token' => $response->getToken(), 'message' => $response->getMessage(), 'requestParams' => $response->getServiceRequestParams(), 'response' => $response->getData() ]; print("<pre>" . print_r($result, true) . "</pre>"); } catch (Exception $e) { throw new \RuntimeException($e->getMessage()); }
购买示例
- 您可以在/examples文件夹中查看purchase.php文件。
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\Masterpass\Gateway; use Examples\Helper; $gateway = new Gateway(); $helper = new Helper(); try { $params = $helper->getPurchaseParams(); $response = $gateway->purchase($params)->send(); $result = [ 'status' => $response->isSuccessful() ?: 0, 'redirect' => $response->isRedirect() ?: 0, 'message' => $response->getMessage(), 'requestParams' => $response->getServiceRequestParams(), 'response' => $response->getData() ]; print("<pre>" . print_r($result, true) . "</pre>"); } catch (Exception $e) { throw new \RuntimeException($e->getMessage()); }
3D购买示例
- 您可以在/examples文件夹中查看purchase3d.php文件。
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\Masterpass\Gateway; use Examples\Helper; $gateway = new Gateway(); $helper = new Helper(); try { $params = $helper->getPurchase3dParams(); $response = $gateway->purchase($params)->send(); $result = [ 'status' => $response->isSuccessful() ?: 0, 'redirect' => $response->isRedirect() ?: 0, 'message' => $response->getMessage(), 'requestParams' => $response->getServiceRequestParams(), 'response' => $response->getData() ]; print("<pre>" . print_r($result, true) . "</pre>"); } catch (Exception $e) { throw new \RuntimeException($e->getMessage()); }
payU购买示例
- 您可以在/examples文件夹中查看payUPurchase.php文件。
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\Masterpass\Gateway; use Examples\Helper; $gateway = new Gateway(); $helper = new Helper(); try { $params = $helper->getPayUPurchaseParams(); $response = $gateway->purchase($params)->send(); $result = [ 'status' => $response->isSuccessful() ?: 0, 'redirect' => $response->isRedirect() ?: 0, 'message' => $response->getMessage(), 'requestParams' => $response->getServiceRequestParams(), 'response' => $response->getData() ]; print("<pre>" . print_r($result, true) . "</pre>"); } catch (Exception $e) { throw new \RuntimeException($e->getMessage()); }
payU 3D购买示例
- 您可以在/examples文件夹中查看payUPurchase3d.php文件。
- 此方法执行哈希检查。
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\Masterpass\Gateway; use Examples\Helper; $gateway = new Gateway(); $helper = new Helper(); try { $params = $helper->getPayUPurchase3dParams(); $response = $gateway->purchase($params)->send(); $result = [ 'status' => $response->isSuccessful() ?: 0, 'redirect' => $response->isRedirect() ?: 0, 'message' => $response->getMessage(), 'requestParams' => $response->getServiceRequestParams(), 'response' => $response->getData() ]; print("<pre>" . print_r($result, true) . "</pre>"); } catch (Exception $e) { throw new \RuntimeException($e->getMessage()); }
请求参数
系统向payU API发送请求。它显示请求信息。
许可
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.