eccore/omnipay-saferpay

Saferpay payment gateway for omnipay

Installs: 244

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 5

Type:omnipay-gateway

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

This package is not auto-updated.

Last update: 2024-04-13 16:51:14 UTC


README

Build Status Total Downloads

Saferpay gateway for awesome Omnipay library.

Warning: Only works with omnipay 2.* versions only!

Installation

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

{
    "require": {
        "eccore/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();
}