eccore / omnipay-saferpay
Saferpay支付网关用于omnipay
dev-master
2016-05-08 16:11 UTC
Requires
- php: >=5.3.2
- omnipay/common: ~2.0
Requires (Dev)
- omnipay/tests: ~2.0
This package is not auto-updated.
Last update: 2024-09-14 19:09:24 UTC
README
警告:仅与omnipay 2.*版本兼容!
安装
要安装,只需将其添加到您的composer.json文件
{ "require": { "eccore/omnipay-saferpay": "dev-master" } }
并运行 composer update
使用方法
1. 授权
$gateway = new \Asci\Omnipay\SaferPay\Gateway(); $gateway->initialize(array( 'accountId' => 'your_account_id', 'testMode' => true, )); $response = $gateway->authorize(array( 'amount' => 199.00, 'description' => 'Google Nexus 4', ))->send(); if ($response->isRedirect()) { // redirect to offsite payment gateway $response->redirect(); } else { // payment failed: display message to customer echo $response->getMessage(); }
2. 完成授权
$gateway = new \Asci\Omnipay\SaferPay\Gateway(); $gateway->initialize(array( 'accountId' => 'your_account_id', 'testMode' => true, )); $response = $gateway->completeAuthorize()->send(); if ($response->isSuccessful()) { // payment was successful print_r($response); } else { // payment failed: display message to customer echo $response->getMessage(); }
3. 捕获
$gateway = new \Asci\Omnipay\SaferPay\Gateway(); $gateway->initialize(array( 'accountId' => 'your_account_id', 'testMode' => true, )); $response = $gateway->capture()->send(); if ($response->isSuccessful()) { // payment was successful print_r($response); } else { // payment failed: display message to customer echo $response->getMessage(); }