/omnipay-vr-payment

A VR Payment gateway driver for the OmniPay framework

Primary LanguagePHPMIT LicenseMIT

VR Payment

GitHub license Packagist GitHub issues Build Status Code Coverage Scrutinizer Code Quality

Table of Contents

Omnipay: VR Payment

VR Payment driver for the Omnipay PHP payment processing library

Written to specication:

This package implements VR Payment support for OmniPay.

VR Payment GmbH

Installation

This is the master branch for the current Omnipay 3.x branch (tested against 3.0.2).

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

{
  "require": {
      "antibodies-online/omnipay-vr-pay": "~1.0"
  }
}

or direct from packagist

composer require "antibodies-online/omnipay-vr-pay: ~1.0"

And run composer to update your dependencies:

$ curl -s http://getcomposer.org/installer | php $ php composer.phar update

Basic Usage

For general usage instructions, please see the main Omnipay repository. You will find more specific details can be found below.

Gateway Background

At least there is only one gateway provided by VR Payment. There's no separate gateway for frontend forms and server-to server requests. However they splitted the tutorials on their document page.

You will most likely be using a mix of COPY+PAY, and Server-to-Server functions as they complement each other, if you want to be SAQ-A(For more information see: PCI) compliant.

Instantiate a gateway

To communicate with vr payment there are different mandatory information which the gateway needs:

  • AccessToken:
    The access token is generated by VR Payment and authenticates your application against the gateway.
  • EntityId:
    The entity id is generated by VR Payment and defines the gateway you want to use (e.g. Credit Card, PayPal,...)

Now let's create the gateway:

    $gateway = Omnipay\Omnipay::create('VrPay_CopyAndPay');
    $gateway->setEntityId('xyz');
    $gateway->setAccessToken('myAccessToken');
    
    $request = $gateway->authorize([
        'transactionId' => $transactionId, // Merchant site ID (or a nonce for it)
        'amount' => 9.99, // Major units
        'currency' => 'EUR',
        'token' => 'creditCardToken', // This is only needed, if you are using COPY+PAY
        'card' => [ // Is not implemented yet
            ....
        ]
    ]);
    $response = $request->send();

Out of standard functions

There are a couple of functions which are not defined in the standard of omnipay. However I think to use COPY+PAY, it's easier to include those function in this package.

  • creditCardCheck()
    This function calls the gateway to create a new checkout id, which is used to generate the payment form.
<form action="{$YOUR_REDIRECT_URL}" class="paymentWidgets" data-brands="VISA MASTER AMEX">&nbsp;</form>
<script type="text/javascript" src="{$JAVASCRIPT_URL}"></script>
{literal}
<script>
    var wpwlOptions = {style:"card"}
</script>
{/literal}
$gateway = Omnipay\Omnipay::create('VrPay_CopyAndPay');
// Set authentication info
$request = $gateway->creditCardCheck()->send();
$javascript_url = $request->getPaymentFormJsUrl();
  • creditCardCheckStatus()
    This function calls the gateway using the reference provided in the query parameters, to query for the payment information of the creditCardCheck form result. This function will extract all needed information out of the url by itself.
$gateway = Omnipay\Omnipay::create('VrPay_CopyAndPay');
$CarCheckStatusResponse = $gateway->creditCardCheckStatus()->send();
if ($CarCheckStatusResponse->isSuccessful()) {
    $token = $CarCheckStatusResponse->getTransactionReference();
}