PHP code example of pindena / omnipay-vipps

1. Go to this page and download the library: Download pindena/omnipay-vipps library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pindena / omnipay-vipps example snippets


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();
}

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

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

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