PHP code example of empatix / omnipay-swedbank

1. Go to this page and download the library: Download empatix/omnipay-swedbank 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/ */

    

empatix / omnipay-swedbank example snippets


use Empatix\OmnipaySwedbank\Gateway;

$gateway = new Gateway();

$gateway->initialize([
    'merchantId' => '',
    'password'   => '',
]);

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

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

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