PHP code example of lemonstand / omnipay-vantiv

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

    

lemonstand / omnipay-vantiv example snippets


	$gateway = Omnipay::create('Vantiv');
	$gateway->setMerchantId($merchantId);
	$gateway->setUsername($username);
	$gateway->setPassword($password);

	// Test mode hits the sandbox endpoint, and pre-live mode hits that preLive endpoint
	// If both are set the pre-live endpoint takes precedence
	$gateway->setTestMode($testMode);
	$gateway->setPreLiveMode($preLiveMode);

    try {
        $params = [
            'transactionId' => $transactionId,
            'orderId'       => $orderId,
            'customerId'    => $customerId,
            'reportGroup'   => $reportGroup,
            'amount'        => $amount,
            'currency'      => $currency,
            'card'          => $validCard,
            'description'   => $description
        ];

        $response = $gateway->purchase($params)->send();

        if ($response->isSuccessful()) {
            // successfull
        } else {
            throw new ApplicationException($response->getMessage());
        }
    } catch (ApplicationException $e) {
        throw new ApplicationException($e->getMessage());
    }