PHP code example of pickupman / omnipay-verifi

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

    

pickupman / omnipay-verifi example snippets


$gateway = Omnipay\Omnipay::create('Verifi');
$gateway->setUsername('username');
$gateway->setPassword('password');

// Example card data
$card = new Omnipay\Common\CreditCard([
    'firstName'       => 'John',
    'lastName'        => 'Doe',
    'billingAddress1' => '888 Main',
    'billingZip'      => '77777',
    'billingCity'     => 'City',
    'billingState'    => 'State',
    'billingPostcode' => 'Zip',
    'number'          => '4111111111111111',
    'expiryMonth'     => '6',
    'expiryYear'      => '2016',
    'cvv'             => '123'
]);

$response = $gateway->purchase(
		         [
			         'card'                 => $card,
			         'amount'               => '10.00',
			         'clientIp'             => $_SERVER['REMOTE_ADDR'],
			         'transactionReference' => '1',
		         ]
		     )->send();

if ( $response->isSuccessful() ) {
	// Continue processing
	$transactionID = $response->getTransactionReference();
}

$gateway = Omnipay\Omnipay::create('Verifi');
$gateway->setUsername('username');
$gateway->setPassword('password');

$response = $gateway->refund(
		         [
			         'amount'               => '10.00',
			         'transactionReference' => 'original transactionid',
		         ]
		     )->send();

if ( $response->isSuccessful() ) {
	// Continue processing
	$transactionID = $response->getTransactionReference();
}

$gateway = Omnipay\Omnipay::create('Verifi');
$gateway->setUsername('username');
$gateway->setPassword('password');

$response = $gateway->void(
		         [
			         'transactionReference' => 'original transactionid',
		         ]
		     )->send();

if ( $response->isSuccessful() ) {
	// Continue processing
	$transactionID = $response->getTransactionReference();
}

$gateway = Omnipay\Omnipay::create('Verifi');
$gateway->setUsername('username');
$gateway->setPassword('password');

// Example card data
$card = new Omnipay\Common\CreditCard([
    'firstName'       => 'John',
    'lastName'        => 'Doe',
    'billingAddress1' => '888 Main',
    'billingZip'      => '77777',
    'billingCity'     => 'City',
    'billingState'    => 'State',
    'billingPostcode' => 'Zip',
    'number'          => '4111111111111111',
    'expiryMonth'     => '6',
    'expiryYear'      => '2016',
    'cvv'             => '123'
]);

$response = $gateway->authorize(
		         [
			         'card'                 => $card,
			         'amount'               => '10.00',
			         'transactionReference' => 'order id or other unique value',
		         ]
		     )->send();

if ( $response->isSuccessful() ) {
	// Continue processing
	$transactionID = $response->getTransactionReference(); // Use this value later to capture
}

$gateway = Omnipay\Omnipay::create('Verifi');
$gateway->setUsername('username');
$gateway->setPassword('password');

$response = $gateway->capture(
		         [
			         'amount'               => '10.00',
			         'transactionReference' => 'order id or other unique value',
		         ]
		     )->send();

if ( $response->isSuccessful() ) {
	// Continue processing
	$transactionID = $response->getTransactionReference(); // Use this value later to capture
}

$gateway = Omnipay\Omnipay::create('Verifi');
$gateway->setUsername('username');
$gateway->setPassword('password');

// Example card data
$card = new Omnipay\Common\CreditCard([
    'firstName'       => 'John',
    'lastName'        => 'Doe',
    'billingAddress1' => '888 Main',
    'billingZip'      => '77777',
    'billingCity'     => 'City',
    'billingState'    => 'State',
    'billingPostcode' => 'Zip',
    'number'          => '4111111111111111',
    'expiryMonth'     => '6',
    'expiryYear'      => '2016',
    'cvv'             => '123'
]);

//Create a subscription
$subscription = $gateway->createCustomSubscription([
	'start_date'      => 'YYYYMMDD', // Defaults to current date if not passed
    'plan_id'         => 'valid plan id from control panel',
    'card'            => $card
])->send();

if ( $subscription->isSuccessful() ) {
	$subscriptionID = $subscription->getSubscriptionId(); // Save for later
}

$gateway = Omnipay\Omnipay::create('Verifi');
$gateway->setUsername('username');
$gateway->setPassword('password');

// Example card data
$card = new Omnipay\Common\CreditCard([
    'firstName'       => 'John',
    'lastName'        => 'Doe',
    'billingAddress1' => '888 Main',
    'billingZip'      => '77777',
    'billingCity'     => 'City',
    'billingState'    => 'State',
    'billingPostcode' => 'Zip',
    'number'          => '4111111111111111',
    'expiryMonth'     => '6',
    'expiryYear'      => '2016',
    'cvv'             => '123'
]);

//Create a subscription
$subscription = $gateway->createCustomSubscription([
    'amount'          => '25.00',
    'month_frequency' => 1, // Billed monthly
    'day_of_month'    => 1, // on first of the month
    'plan_payments'   => 0, // indefinitely or cancelled
    'card'            => $card
])->send();

if ( $subscription->isSuccessful() ) {
	$subscriptionID = $subscription->getSubscriptionId(); // Save for later
}

$gateway = Omnipay\Omnipay::create('Verifi');
$gateway->setUsername('username');
$gateway->setPassword('password');

$subscription = $gateway->deleteSubscription([
    'subscription_id' => 'subscription id here'
])->send();


$gateway = Omnipay\Omnipay::create('Verifi');
$gateway->setUsername('username');
$gateway->setPassword('password');

// Example card data
$card = new Omnipay\Common\CreditCard([
    'firstName'       => 'John',
    'lastName'        => 'Doe',
    'billingAddress1' => '888 Main',
    'billingZip'      => '77777',
    'billingCity'     => 'City',
    'billingState'    => 'State',
    'billingPostcode' => 'Zip',
    'number'          => '4111111111111111',
    'expiryMonth'     => '6',
    'expiryYear'      => '2016',
    'cvv'             => '123'
]);

$response = $gateway->createCard([
				'card' => $card
			]);

if ( $response->isSuccessful() ) {
	$vaultId = $response->getToken();
}

$gateway = Omnipay\Omnipay::create('Verifi');
$gateway->setUsername('username');
$gateway->setPassword('password');

// Example card data
$card = new Omnipay\Common\CreditCard([
    'firstName'       => 'John',
    'lastName'        => 'Doe',
    'billingAddress1' => '888 Main',
    'billingZip'      => '77777',
    'billingCity'     => 'City',
    'billingState'    => 'State',
    'billingPostcode' => 'Zip',
    'number'          => '4111111111111111',
    'expiryMonth'     => '6',
    'expiryYear'      => '2016',
    'cvv'             => '123'
]);

$subscription = $gateway->updateSubscription([
					'subscription_id' => 'subscription id here',
					'card' => $card
				]);

if ( $subscription->isSuccessful() ) {
	$subscriptionID = $subscription->getSubscriptionId();
}

$gateway = Omnipay\Omnipay::create('Verifi');
$gateway->setTestMode(true); // Automatically sets default testing gateway username and password