asci / omnipay-saferpay
omnipay的Saferpay支付网关
dev-master
2015-04-20 14:26 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 15:11:17 UTC
README
警告:目前仅与omnipay 1.*版本兼容
安装
要安装,只需将其添加到您的composer.json文件
{ "require": { "asci/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(); }