PHPackages                             cogitech/dotpay-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. cogitech/dotpay-bundle

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

cogitech/dotpay-bundle
======================

Symfony payment bundle for Dotpay

21.4k2PHP

Since Mar 18Pushed 10y ago3 watchersCompare

[ Source](https://github.com/cogitech-group/DotpayBundle)[ Packagist](https://packagist.org/packages/cogitech/dotpay-bundle)[ RSS](/packages/cogitech-dotpay-bundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

DotpayBundle
------------

[](#dotpaybundle)

DotpayBundle provides basic functionality to create online payments for [dotpay.pl](http://dotpay.pl/)

Installation
------------

[](#installation)

The recommended way to install this bundle is to rely on [Composer](https://getcomposer.org/):

```
"require" : {
	// ...
    "cogitech/dotpay-bundle": "dev-master"
}
```

The second step is to register this bundle in the `AppKernel` class:

```
public function registerBundles()
{
	$bundles = array(
       // ...
       new Cogitech\DotpayBundle\CogitechDotpayBundle(),
    );
}
```

### Configuration

[](#configuration)

Add following section in your `config.yml` file:

```
cogitech_dotpay:
	production: true
    login: 'login'
    password: 'password'
    shop_id: '123456'
```

Parameters description:

- **production** - `false` value idicates test mode, `true` value indicates production mode. This parameter is required.
- **login** - Login to your dotpay account. This parameter is required.
- **password** - Password to your dotpay account. This parameter is required.
- **shop\_id** - This is your shop id. This parameter is required.
- **firewall** - This parameter is not required. By default payment confirmation can be done from Dotpay IP servers only (`195.150.9.37`). You can pass here array of valid IP addresses or `false` to disable firewall (not recommended).
- **route\_complete** - This is the symfony2 route where youser will be redirected from Dotpay website. This parameter is optional and default value is `cg_dotpay_thanks`.

Basic usage
-----------

[](#basic-usage)

Render payment button in twig template by calling `dotpay_button` function:

```
{{ dotpay_button({
      title: 'Dotpay - 1.23 zł',
      class: 'btn btn-success',
      email: 'test@example.com',
      price: 1.23,
      first_name: 'Lorem',
      last_name: 'Ipsum',
      street: 'Lorem street',
      building_number: '1',
      postcode: '60-001',
      city: 'Lorem',
      description: 'Lorem Product',
      params: {
      	custom_parameter: '123'
	  }
   })
}}
```

Key `params` is optional. You can pass custom parameters to event this way.

### Events

[](#events)

Register event listeners to process DotpayBundle events:

Services file `services.yml`:

```
services:
    cg.dotpay.listeners:
        class: AppBundle\EventListener\cgDotpayEventListener
        tags:
        	- { name: kernel.event_listener, event: cg.dotpay.create, method: create }
            - { name: kernel.event_listener, event: cg.dotpay.change_status, method: change_status }
            - { name: kernel.event_listener, event: cg.dotpay.confirm, method: confirm }
            - { name: kernel.event_listener, event: cg.dotpay.cancel, method: cancel }
```

Event listener class `cgDotpayEventListener`:

```
