PHP code example of ubitransports / omnipay-payzen

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

    

ubitransports / omnipay-payzen example snippets


$paymentParams = array(
    ...
    'createCard' => true,
    'ownerReference' => 'an owner reference',
));
$purchaseRequest = $gateway->purchase($paymentParams);
$redirectResponse = $purchaseRequest->send();

$paymentParams = array(
    ...
    'ownerReference' => 'an owner reference',
));
$createCardRequest = $gateway->createCard($paymentParams);
$redirectResponse = $createCardRequest->send();

$paymentParams = array(
    ...
));
$completePurchaseRequest = $gateway->completePurchase($paymentParams);
$callbackResponse = $completePurchaseRequest->send();
if ($callbackResponse->hasCreatedCard()) {
    $cardReference = $callbackResponse->getCardReference();
    $ownerReference = $callbackResponse->getOwnerReference();
}

$paymentParams = array(
    ...
    'cardReference' => 'XXXXXXXXXX',
));
$purchaseRequest = $gateway->purchase($paymentParams);
$redirectResponse = $purchaseRequest->send();