pindena/omnipay-vipps

Vipps driver for the Omnipay payment processing library

v1.0.16 2023-09-15 18:05 UTC

This package is auto-updated.

Last update: 2024-05-15 19:39:43 UTC


README

Vipps driver for the Omnipay PHP payment processing library

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

Installation

Omnipay is installed via Composer. To install, simply require league/omnipay and pindena/omnipay-vipps with Composer:

composer require league/omnipay pindena/omnipay-vipps

Basic Usage

The following gateways are provided by this package:

  • Vipps (Vipps Ecomm Checkout)

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

Initialize gateway, authorize and redirect to Vipps

use Pindena\Omnipay\Vipps\Gateway;

$gateway = new Gateway();

$gateway->initialize([
    'clientId'             => '',
    'clientSecret'         => '',
    'ocpSubscription'      => '',
    'merchantSerialNumber' => '',
]);

$response = $gateway->authorize([
    'amount'      => '10.00',
    'currency'    => 'NOK',
    'description' => 'This is a test transaction',
    'phone'       => $_POST['phone'],
    'returnUrl'   => $fallbackUrl,
    'notifyUrl'   => $callbackPrefix,
])->send();

if ($response->isRedirect()) {
    $response->redirect();
}

Capture the authorized amount

$response = $gateway->capture([
    'amount'               => $amount,
    'description'          => 'This is a test transaction',
    'transactionReference' => $transactionReference,
])->send();

Get the transaction details

$response = $gateway->completeAuthorize(['transactionReference' => $transactionReference])->send();

Troubleshooting headers

Vipps requires partners and platforms to send special headers on all requests. This can be achieved by adding headers in the initialize options or on each request.

$gateway->initialize([
    'clientId'             => '',
    'clientSecret'         => '',
    'ocpSubscription'      => '',
    'merchantSerialNumber' => '',
    'headers'              => [
        'Vipps-System-Name' => 'System name',
        'Vipps-System-Version' => 'v1.0',
    ],
]);

Quirks

Vipps will send a notify-request to [notifyUrl]/v2/payments/[orderId]. For Laravel this means you will need to register a POST route in web.php which listens on /v2/payments/{orderId} for handling payment notifications from Vipps.

Out Of Scope

Omnipay does not cover recurring payments or billing agreements, and so those features are not included in this package. Extensions to this gateway are always welcome.

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.