PHP code example of colinodell / omnipay-bundle

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

    

colinodell / omnipay-bundle example snippets


new ColinODell\OmnipayBundle\OmnipayBundle(),

$this->get('omnipay')->get('MyTest');

$omnipay->getDefaultGateway();



// AppBundle/Omnipay/Omnipay.php

namespace AppBundle\Omnipay;

use AppBundle\Payment\Processing\Gateway\VaultAwareGateway;
use ColinODell\OmnipayBundle\Service\Omnipay as BaseOmnipay;
use Omnipay\Common\GatewayInterface;

class Omnipay extends BaseOmnipay
{
    /**
     * @return VaultAwareGateway[]
     */
    public function getVaultAwareGateways()
    {
        return array_filter($this->registeredGateways, function (GatewayInterface $gateway) {
            return $gateway instanceof VaultAwareGateway;
        });
    }
}

foreach ($omnipay->getVaultAwareGateways() as $gateway) {
    $gateway->saveCreditCard($creditCard); // assuming saveCreditCard is a part of VaultAwareGateway interface
}

 php
$stripe = $this->get('omnipay')->get('Stripe');

$paypal = $this->get('omnipay')->get('PayPal_Express');