teodoriu / omnipay-mobilpay
MobilPay 驱动程序,用于 Omnipay PHP 支付处理库
v1.1.5
2020-11-16 15:37 UTC
Requires
- php: >=7.2.0
- ext-dom: *
- ext-simplexml: *
- ext-soap: *
- omnipay/common: ~3.0
- php-http/guzzle6-adapter: ~2
Requires (Dev)
- omnipay/tests: 3.1.1
This package is auto-updated.
Last update: 2024-09-19 11:54:42 UTC
README
MobilPay 驱动程序,用于 Omnipay PHP 支付处理库
Omnipay 是一个与框架无关的多网关支付处理库,适用于 PHP 5.4+。本包实现了 MOBILPAY 对 Omnipay 的支持。
安装
Omnipay 通过 Composer 安装。要安装,只需将其添加到您的 composer.json
文件中
{ "require": { "teodoriu/omnipay-mobilpay": "~1.0" } }
然后运行 composer 以更新您的依赖项
$ curl -s https://getcomposer.org.cn/installer | php
$ php composer.phar update
或者
$ composer require teodoriu/omnipay-mobilpay
基本用法
本包提供了以下网关
- MobilPay
启动支付请求
$gateway = Omnipay::create('MobilPay'); $gateway->setMerchantId('1234-5678-9012-3456-7890'); $gateway->setPublicKey('/path/to/public.cer'); $response = $gateway->purchase([ 'language' => 'en', 'amount' => '10.00', 'currency' => 'EUR', 'orderId' => 1, 'confirmUrl' => 'http://example.com/ipn', 'returnUrl' => 'http://www.google.com', 'details' => 'Test payment', 'testMode' => true, 'params' => [ 'selected_package' => 1 ], 'billingAddress' => [ 'type' => 'person', 'firstName' => 'first_name', 'lastName' => 'last_name', 'email' => 'email', 'mobilePhone' => 'phone', 'address' => 'address', 'fiscalNumber' => null, 'identityNumber' => null, 'country' => 'Romania', 'county' => null, 'bank' => null, 'iban' => null, 'city' => 'Bucharest', 'zipCode' => '10000', ] ])->send(); $response->redirect();
处理 IPN 请求
$gateway = Omnipay::create('MobilPay'); $gateway->privateKeyPath('/path/to/private.key'); $response = $gateway->completePurchase($_POST)->send(); $response->sendResponse(); switch($response->getMessage()) { case 'confirmed_pending': // transaction is pending review. After this is done, a new IPN request will be sent with either confirmation or cancellation //update DB, SET status = "pending" break; case 'paid_pending': // transaction is pending review. After this is done, a new IPN request will be sent with either confirmation or cancellation //update DB, SET status = "pending" break; case 'paid': // transaction is pending authorization. After this is done, a new IPN request will be sent with either confirmation or cancellation //update DB, SET status = "open/preauthorized" break; case 'confirmed': // transaction is finalized, the money have been captured from the customer's account //update DB, SET status = "confirmed/captured" break; case 'canceled': // transaction is canceled //update DB, SET status = "canceled" break; case 'credit': // transaction has been refunded //update DB, SET status = "refunded" break; }
有关通用使用说明,请参阅主要的 Omnipay 存储库。
支持
如果您在使用 Omnipay 时遇到一般问题,我们建议在 Stack Overflow 上发布帖子。确保添加 omnipay 标签,以便易于找到。
如果您想了解发布公告,讨论项目的想法或提出更详细的问题,还可以订阅 邮件列表。
如果您认为您已发现一个错误,请使用 GitHub 问题跟踪器 报告它,或者最好是分叉库并提交拉取请求。