asci/omnipay-saferpay

Saferpay payment gateway for omnipay

Installs: 38 772

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 7

Open Issues: 2

Type:omnipay-gateway

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

This package is not auto-updated.

Last update: 2020-07-24 18:21:22 UTC


README

Build Status Total Downloads

Saferpay gateway for awesome Omnipay library.

Warning: Only works with omnipay 1.* versions for the moment

Installation

To install, simply add it to your composer.json file:

{
    "require": {
        "asci/omnipay-saferpay": "dev-master"
    }
}

and run composer update

Usage

1. Authorize

$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. Complete Authorize

$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. Capture

$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();
}