dercoder/omnipay-wirecard

Wirecard gateway for Omnipay payment processing library

dev-master / 1.x-dev 2020-09-18 19:24 UTC

This package is auto-updated.

Last update: 2024-09-19 04:18:04 UTC


README

Wirecard driver for the Omnipay PHP payment processing library

Build Status Coverage Status

Latest Stable Version Total Downloads Latest Unstable Version License

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements Wirecard support for Omnipay.

This library only supports Wirecard Checkout Page payment yet. You can read more about the Checkout Page solution here.

Installation

Omnipay is installed via Composer. To install, simply add it to your composer.json file:

{
    "require": {
        "dercoder/omnipay-wirecard": "~1.0"
    }
}

It will also install the Omnipay package if it's not available in the autoload.

Basic usage

The following gateways are provided by this package:

  • Wirecard (Wirecard Checkout Page)

For general usage instructions, please see the main Omnipay repository.

Firstly create the gateway:

$gateway = Omnipay\Omnipay::create('Wirecard');
$gateway->setCustomerId('D200001'); // this is a valid demo customer id
$gateway->setShopId('3D'); // this is optional
$gateway->setSecret('B8AKTPWBRMNBV455FG6M2DANE99WU2'); // this is also valid for developing

Secondly prepare the required parameters:

$parameters = [
    'paymentType' => 'CCARD', // optional, default SELECT
    'transactionId' => 'TX54434',
    'currency' => 'EUR',
    'description' => 'Awesome Product',
    'language' => 'EN',
    'returnUrl' => 'http://your-website.com/response?type=success',
    'cancelUrl' => 'http://your-website.com/response?type=cancel',
    'pendingUrl' => 'http://your-website.com/response?type=pending',
    'notifyUrl' => 'http://your-website.com/response?type=notify',
    'serviceUrl' => 'http://your-website.com/response?type=service',
    'imageUrl' => 'http://your-website.com/logo.png', // optional
    'amount' => '100.00'
];

If any required parameter is missing you will get an InvalidRequestException when you create the request:

$request = $gateway->purchase($parameters);

Send the request:

$response = $request->send();

Lastly handle the response:

if ($response->isRedirect()) {
    $response->redirect(); // redirect the browser to the Wirecard Checkout Page
} else {
    echo 'Error: ' . $response->getMessage();
}

If you would like to handle return urls from the Checkout page use this on your response page:

$gateway = Omnipay\Omnipay::create('Wirecard');
$gateway->setCustomerId('D200001');
$gateway->setSecret('B8AKTPWBRMNBV455FG6M2DANE99WU2');
$request = $gateway->completePurchase();
$response = $request->send();

if ($response->isSuccessful()) {
    echo 'Succesful payment!';
} else if ($response->isCancelled()) {
    echo 'Payment has been cancelled.';
} else if ($response->isPending()) {
    echo 'Your payment is in pending status.';
} else {
    echo $response->getMessage();
}

The getMessage() and getData() methods are available in the response object for further actions.

List of available payment types

Payment type is highly depended on your contract with Wirecard, but these are the currently available values: