PHP code example of superbrave / omnipay-icepay-payments

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

    

superbrave / omnipay-icepay-payments example snippets


$gateway = Omnipay\Omnipay::create('\Omnipay\IcepayPayments\Gateway');
// or
$gateway = new \Omnipay\IcepayPayments\Gateway(/* $httpClient, $httpRequest */);

$gateway->initialize([
    'secretKey' => $secretKey, // The given secret key.
    'contractProfileId' => $contractProfileId, // The given contract profile id or user id.
    'testMode' => false // Optional, default: true
]);
// or
$gateway->setSecretKey($secretKey);
$gateway->setContractProfileId($contractProfileId);

$data = [
    'Contract' => [
        'ContractProfileId' => '85cf0581-36e2-45c7-8d8c-a24c6f52902c',
        'AmountInCents' => 1337,
        'CurrencyCode' => 'EUR',
        'Reference' => '829c7998-6497-402c-a049-51801ba33662',
    ],
    'Postback' => [
        'UrlCompleted' => 'https://www.superbrave.nl/return-url',
        'UrlError' => 'https://www.superbrave.nl/cancel-url',
        'UrlsNotify' => [
            'https://www.superbrave.nl/notify-url',
        ],
    ],
    'IntegratorFootprint' => [
        'IPAddress' => '127.0.0.1',
        'TimeStampUTC' => '0',
    ],
    'ConsumerFootprint' => [
        'IPAddress' => '127.0.0.1',
        'TimeStampUTC' => '0',
    ],
    'Fulfillment' => [
        'PaymentMethod' => 'IDEAL',
        'IssuerCode' => 'ABNAMRO',
        'AmountInCents' => 1337,
        'CurrencyCode' => 'EUR',
        'Consumer' => [
            'Address' => [
                'CareOf' => null,
                'City' => 'Bree duh',
                'CountryCode' => 'NL',
                'HouseNumber' => null,
                'PostalCode' => '4817 HX',
                'Street' => 'Quite 18',
            ],
            'Category' => 'Person',
        ],
        'Timestamp' => '2019-03-09T12:00:00Z',
        'LanguageCode' => 'nl',
        'CountryCode' => 'NL',
        'Reference' => '829c7998-6497-402c-a049-51801ba33662',
        'Order' => [
            'OrderNumber' => '12345AB',
            'CurrencyCode' => 'EUR',
            'TotalGrossAmountCents' => 1337,
            'TotalNetAmountCents' => 1337,
        ],
        'Description' => '829c7998-6497-402c-a049-51801ba33662',
    ],
];

$request = $gateway->authorize($data);

$response = $response->send();

$data = [
    'ContractProfileId' => '85cf0581-36e2-45c7-8d8c-a24c6f52902c',
    'AmountInCents' => 1337,
    'CurrencyCode' => 'EUR',
    'Reference' => '829c7998-6497-402c-a049-51801ba33662',
];

$request = $gateway->fetchTransaction($data);

$response = $request->send();

$data = [
    'ContractProfileId' => '85cf0581-36e2-45c7-8d8c-a24c6f52902c',
    'AmountInCents' => 1337,
    'CurrencyCode' => 'EUR',
    'Reference' => '829c7998-6497-402c-a049-51801ba33662',
];

$request = $gateway->refund($data);

$response = $request->send();