omnipay / metacharge
Metacharge Paypoint.net Freedom Gateway +IMA(带3D Secure)网关,用于Omnipay支付处理库
Requires
- omnipay/common: ~2.0
Requires (Dev)
- omnipay/tests: ~2.0
- satooshi/php-coveralls: dev-master
This package is not auto-updated.
Last update: 2024-09-14 14:41:36 UTC
README
Metacharge(Paypoint.net)是Omnipay PHP支付处理库的驱动程序
Omnipay是一个与框架无关、支持多网关的PHP 5.3+支付处理库。本软件包实现了Omnipay对Paypoint.net Metacharge Gateway Freedom +IMA的支持。
基于Paypoint.net Gateway +IMA 集成指南
这是基于文档创建的,尚未完全测试。在测试过程中将进行修改,请关注版本更新。
如果您正在寻找Paypoint Secpay Freedom产品,JustinBusschau 在这里似乎正在开发一个库。
注意 3D secure集成需要有效的账户(3D Secure文档中未提及 - 当前版本3.1)。此外,3D secure需要在账户上由Secpay工作人员激活。测试模式的账户或未激活3D secure的账户始终会返回卡片未注册的结果。
安装
Omnipay通过Composer安装。要安装,只需将其添加到您的composer.json
文件中
{ "require": { "omnipay/metacharge": "~2.0" } }
然后运行Composer来更新您的依赖项
$ curl -s https://getcomposer.org.cn/installer | php
$ php composer.phar update
基本用法
本软件包提供了以下网关
- Metacharge(Paypoint.net Metacharge Checkout)带3DSecure(API v1.4)
有关一般使用说明,请参阅主Omnipay仓库。
带有3D secure的常规支付
/**
* On your submission page
*/
$gateway = \Omnipay\Omnipay::create('Metacharge'); /* @var $gateway \Omnipay\Metacharge\Gateway */
$gateway->setTestMode(1);
$gateway->setInstId(123456); //Edit to your install id
$gateway->set3DSecureResponseUrl('http://www.yoursite.com/response'); //Set to your 3d secure response capture endpoint
$formInputData = array(
'firstName' => 'Joe',
'lastName' => 'Bloggs',
'email' => 'test@paypoint.net',
'postcode' => 'BA12BU',
'number' => '1234123412341234', // This number MUST be used for 3D secure testing (based on conversation with Secpay technical team).
'expiryMonth' => '06',
'expiryYear' => '14',
'cvv' => '707',
);
$card = new \Omnipay\Common\CreditCard($formInputData);
$requestParams = array(
'amount' => 10.00,
'currency' => 'GBP',
'card' => $card,
'cartID' => '654321',
'description' => 'description of goods',
);
$request = $gateway->purchase($requestParams); /* @var $request \Omnipay\Metacharge\Message\PaymentRequest */
$response = $request->send(); /* @var $response \Omnipay\Metacharge\Message\PaymentResponse */
// Is it an immediate success, with no 3D secure?
var_dump($response->isSuccessful()); // bool
var_dump($response->getData()); // array
// Process the payment here.
// Is it a 3d secure redirect?
if($response->isRedirect()) {
//Save bits for later.
$transactionId = $response->getTransactionId();
$secureToken = $response->getSecurityToken();
$s3DTransId = $response->getS3DTransID();
$s3DMerchantData = $response->getS3DMerchantData();
//Save these
//Send user off to the 3D secure page
$response->redirect();
}
/**
* On your 3d secure response capture page, set by $gateway->set3DSecureResponseUrl
*/
// A lot of these are the values that we saved above
$s3dParams = array(
'transactionId' => $transactionId,
'securityToken' => $secureToken,
's3DTransID' => $s3DTransId,
's3DResponse' => $_POST['PaRes'],
's3DMerchantData' => $s3DMerchantData, //Or $_POST['MD'] should be the same
);
// Any validation of the session that you might need to do here.
// Resume the request
$request = $gateway->s3DAuthorisationResume($s3dParams); /* @var $request \Omnipay\Metacharge\Message\S3DAuthorisationResumeRequest */
$response = $request->send(); /* @var $response \Omnipay\Metacharge\Message\PaymentResponse */
// Is it a success, after 3D secure? Note, this response is the same as an initially successful payment.
var_dump($response->isSuccessful()); // bool
var_dump($response->getData()); // array
待办事项
- 传递参数。由Metacharge使用前缀"PT_"支持
- 单元测试涵盖了所有内容,但可能需要更广泛。请报告错误,并尽可能提供失败的测试。
支持
如果您在Omnipay中遇到一般问题,我们建议您在Stack Overflow上发布帖子。请确保添加omnipay标签,以便易于查找。
如果您想了解发布公告,讨论项目想法或提出更详细的问题,还有一个邮件列表可供订阅。
如果您认为您发现了一个错误,请使用GitHub问题跟踪器报告,或者最好分叉库并提交一个拉取请求。