2017 © Pedro Peláez
 

symfony-bundle omnipay-bundle

Integrates Omnipay with Symfony2

image

xola/omnipay-bundle

Integrates Omnipay with Symfony2

  • Tuesday, June 26, 2018
  • by anush
  • Repository
  • 6 Watchers
  • 10 Stars
  • 15,762 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 11 Forks
  • 0 Open issues
  • 6 Versions
  • 1 % Grown

The README.md

Xola OmnipayBundle Build status...

This bundle integrates the Omnipay payment processing library into Symfony2., (*1)

This bundle supports Omnipay 3, (*2)

Installation

To install via Composer, add the following to your composer.json file:, (*3)

{
    "require": {
        "xola/omnipay-bundle": "^3"
    }
}

Add the bundle to your application kernel., (*4)

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Xola\OmnipayBundle\OmnipayBundle(),
        // ...
    );
}

Configuration

(Optional) In the Omnipay library, you would programmatically set parameters required by a gateway. With this bundle, it's possible to configure these parameters in your Symfony config files., (*5)

# app/config/password_dev.yml
parameters:
    # Custom gateway
    omnipay.my_custom_key.apiKey: myGatewayKey
    omnipay.my_custom_key.gateway: MyGateway

    # Default Stripe gateway
    omnipay.stripe_default.apiKey: myApiKey
    omnipay.stripe_default.gateway: Stripe

    # Gateway for Stripe Canada account
    omnipay.stripe_canada.apiKey: myStripeCanadaApiKey
    omnipay.stripe_canada.gateway: Stripe

    # Authorize.NET AIM
    omnipay.authorize_net_aim.transactionKey: myTransactionKey
    omnipay.authorize_net_aim.gateway: AuthorizeNet_AIM

In the sample configuration above, my_custom_key is a unique key you define for each of your gateways. omnipay.my_custom_name.gateway is the class name for a Omnipay gateway driver (e.g. Stripe). You may choose to define multiple keys for the same Omnipay gateway with different credentials. In the above configuration, we have configured two gateway definitions for Stripe -- both use the Stripe Omnipay driver, however, they each use a different set of credentials., (*6)

Usage

Use the new omnipay service to create gateway object:, (*7)

    // From within a controller. This will return an instance `\Omnipay\Stripe`. `stripe_default` is the key as
    // specified in the config.
    $gateway = $this->get('omnipay')->get('stripe_default');

    // From within a controller. This will return an instance of `\Omnipay\MyGateway` as specified in
    // `omnipay.my_custom_name.gateway`
    $gateway = $this->get('omnipay')->get('my_custom_name');

The rest is identical to how you would normally use Omnipay, (*8)

$formData = ['number' => '4242424242424242', 'expiryMonth' => '11', 'expiryYear' => '2018', 'cvv' => '123'];
$response = $gateway->purchase(['amount' => '10.00', 'currency' => 'USD', 'card' => $formData])->send();

if ($response->isSuccessful()) {
    // payment was successful: update database
    print_r($response);
} elseif ($response->isRedirect()) {
    // redirect to offsite payment gateway
    $response->redirect();
} else {
    // payment failed: display message to customer
    echo $response->getMessage();
}

The gateway classes which are returned are already initialized with the parameters defined in the config files., (*9)

The Versions

26/06 2018

dev-master

9999999-dev https://github.com/xola/OmnipayBundle

Integrates Omnipay with Symfony2

  Sources   Download

MIT

The Requires

 

The Development Requires

by Venkata Krishna Kotra
by Anush Ramani

payment gateway omnipay symfony credit card

26/06 2018

v1.2.1

1.2.1.0 https://github.com/xola/OmnipayBundle

Integrates Omnipay with Symfony2

  Sources   Download

MIT

The Requires

 

The Development Requires

by Venkata Krishna Kotra
by Anush Ramani

payment gateway omnipay symfony credit card

07/05 2018

v1.2

1.2.0.0 https://github.com/xola/OmnipayBundle

Integrates Omnipay with Symfony2

  Sources   Download

MIT

The Requires

 

The Development Requires

by Venkata Krishna Kotra
by Anush Ramani

payment gateway omnipay symfony credit card

11/03 2015

v1.1.0

1.1.0.0 https://github.com/xola/OmnipayBundle

Integrates Omnipay with Symfony2

  Sources   Download

MIT

The Requires

 

The Development Requires

by Venkata Krishna Kotra
by Anush Ramani

payment gateway omnipay symfony credit card

16/09 2014

v1.0.0

1.0.0.0 https://github.com/xola/OmnipayBundle

Integrates Omnipay with Symfony2

  Sources   Download

MIT

The Requires

 

The Development Requires

by Venkata Krishna Kotra
by Anush Ramani

payment gateway omnipay symfony credit card

25/11 2013

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/xola/OmnipayBundle

Integrates Omnipay with Symfony2

  Sources   Download

MIT

The Requires

 

by Anush Ramani

payment gateway omnipay credit card