PHPackages                             snowcap/ogone-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. snowcap/ogone-bundle

ActiveSymfony-bundle[Payment Processing](/categories/payments)

snowcap/ogone-bundle
====================

Ogone wrapper for Symfony2

v1.0.1(10y ago)45.2k7[1 PRs](https://github.com/snowcap/SnowcapOgoneBundle/pulls)MITPHPPHP &gt;=5.3.2

Since May 17Pushed 10y ago2 watchersCompare

[ Source](https://github.com/snowcap/SnowcapOgoneBundle)[ Packagist](https://packagist.org/packages/snowcap/ogone-bundle)[ Docs](https://github.com/snowcap/SnowcapOgoneBundle)[ RSS](/packages/snowcap-ogone-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (5)Used By (0)

Introduction
============

[](#introduction)

This bundle introduces the Ogone payment process gateway into a Symfony project It uses the marlon-ogone Bundle, and adds a different integration approach

More info about Ogone can be found here:

WARNING: THIS BUNDLE IS IN BETA STAGE, USE AT YOUR OWN RISKS !

Prerequisites
=============

[](#prerequisites)

- Symfony 2.1&gt;=
- You must have a valid Ogone account, configured with SHA-IN and SHA-OUT security activated

Installation
============

[](#installation)

Download the bundle:

```
{
"require": {
    "snowcap/ogone-bundle": "dev-master"
}
```

```
$ php composer.phar update snowcap/ogone-bundle
```

Add it to your application's kernel:

```
// app/ApplicationKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Snowcap\OgoneBundle\SnowcapOgoneBundle(),
        // ...
    );
}
```

Configuration
=============

[](#configuration)

Put the following configuration options in your config file:

```
snowcap_ogone:
    pspid: [your_ogone_pspid]
    environment: [test|prod]
    sha_in: [your_ogone_sha_in_passhprase]
    sha_out: [your_ogone_sha_out_passhprase]
    options:
        # any option you may want to pass to Ogone, as key: value pairs
```

Usage
=====

[](#usage)

Getting the Ogone form to use in your view
------------------------------------------

[](#getting-the-ogone-form-to-use-in-your-view)

A service 'snowcap\_ogone.manager' allows you to get the ogone form rendering, whereby you can also define the acceptUrl, and any other option you want to send to Ogone An example could be:

```
/** @var $ogone \Snowcap\OgoneBundle\Manager */
$ogone = $this->get('snowcap_ogone');

$ogoneForm = $ogone->getRequestForm($locale, $orderId, $customerName, $amount, $currency, array(
    'acceptUrl' => $this->generateUrl('your_success_page_route_name', array(), true),
    // and any other option your may want to pass to Ogone
));

return array(
    'ogone_form' => $ogoneForm,
);
```

Pay attention, this is not a Symfony form, just a simple rendered form provided by the Ogone library.

```
...
{{ ogone_form|raw }}
```

Getting Ogone result
--------------------

[](#getting-ogone-result)

First you need to add a route in your routing.yml

```
snowcap_ogone:
    resource: "@SnowcapOgoneBundle/Controller"
    type: annotation
```

To catch Ogone's result, you have to create a service and tag it as an event subscriber (or an event listener): For example:

```
my_company_bundle.ogone_subscriber:
    class: MyCompany\MyBundle\Ogone\OgoneSubscriber
    tags:
        - { name: kernel.event_subscriber }
```

That service has to implement the EventSubscriberInterface, like the following:

```
