PHP code example of dranes / omnipay-ippay

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

    

dranes / omnipay-ippay example snippets


use Omnipay\Omnipay;
use Omnipay\Common\GatewayFactory;
use Omnipay\Common\Helper;
use Omnipay\Common\CreditCard;

$gateway = Omnipay::create('Ippay');
$gateway->setTerminalId('xxxxxxxx');
$gateway->setTestMode(true);

$creditCardData = [
    'firstName' => 'John',
    'lastName' => 'Doe',
    'number' => '4111111111111111',
    'expiryMonth' => '02',
    'expiryYear' => '22',
    'cvv' => '123'
];

$card = new CreditCard($creditCardData);
$ccResponse = $gateway->createCard([
    'card' => $card
])->send();    

$message = $ccResponse->getMessage();

$response = new \SimpleXMLElement($message);
if($ccResponse->isSuccessful()) {
    $token = $response->Token;
} else {
    $error = $response->ResponseText;
}