eccore / omnipay-saferpay

Saferpay支付网关用于omnipay

安装: 246

依赖者: 0

建议者: 0

安全: 0

星星: 1

关注者: 2

分支: 5

类型:omnipay-gateway

dev-master 2016-05-08 16:11 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:09:24 UTC


README

Build Status Total Downloads

Saferpay网关,用于出色的Omnipay库。

警告:仅与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();
}