asci/omnipay-saferpay

omnipay的Saferpay支付网关

安装次数: 38,774

依赖者: 0

建议者: 0

安全: 0

星标: 2

关注者: 2

分支: 5

开放问题: 0

类型: omnipay-gateway

dev-master 2015-04-20 14:26 UTC

This package is not auto-updated.

Last update: 2024-09-14 15:11:17 UTC


README

Build Status Total Downloads

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

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