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/ */
$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
}