asci/omnipay-saferpay

Saferpay payment gateway for omnipay

Installs: 38 774

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 5

Open Issues: 0

Type:omnipay-gateway

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

This package is not auto-updated.

Last update: 2024-04-13 12:59:00 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();
}