PHPackages                             sinenco/allopasspayment - 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. sinenco/allopasspayment

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

sinenco/allopasspayment
=======================

Payment with Allopass for Symfony

1.2(10y ago)048PHPPHP &gt;=5.4.0

Since Jul 6Pushed 10y ago1 watchersCompare

[ Source](https://github.com/jordandegea/AllopassPayment)[ Packagist](https://packagist.org/packages/sinenco/allopasspayment)[ RSS](/packages/sinenco-allopasspayment/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

AllopassPayment
===============

[](#allopasspayment)

(Use sinenco/allopassapi package)

Installation in Composer
========================

[](#installation-in-composer)

add in composer require : "sinenco/AllopassPayment" : "1.\*"

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

[](#configuration)

AppKernel
---------

[](#appkernel)

```
new Sinenco\AllopassPaymentBundle\SinencoAllopassPaymentBundle(),
new Sinenco\AllopassAPIBundle\SinencoAllopassAPIBundle()

```

Parameters
----------

[](#parameters)

### AllopassPayment

[](#allopasspayment-1)

```
parameters:
    allopass_payment.site_id: "Your site ID"
    allopass_payment.product_name: "Your Product Name"
    sinenco.allopass_payments.return_route: "Your controller page for return"

```

When a user pay with allopass, he will be redirected to this page. With GET parameters : RECALL, data, code, trxid, transaction\_id. The transaction is not checked with return URL but with callback url.

### AllopassAPI

[](#allopassapi)

```
parameters:
    allopassAPI.api_key: "your api key"
    allopassAPI.secret_key: "your secret key"

    allopassAPI.default_hash: "sha1"
    allopassAPI.default_format: "xml"
    allopassAPI.network_timeout: "30"
    allopassAPI.network_protocol: "http"
    allopassAPI.network_port: "80"
    allopassAPI.host: "api.allopass.com"

```

You can use HTTPS with 443 too

Service to add
--------------

[](#service-to-add)

```
services:
    sinenco_allopass_api.init:
        class: Sinenco\AllopassAPIBundle\Model\AllopassApiConf
        arguments:
            api_key: %allopassAPI.api_key%
            secret_key: %allopassAPI.secret_key%
            default_hash: %allopassAPI.default_hash%
            default_format: %allopassAPI.default_format%
            network_timeout: %allopassAPI.network_timeout%
            network_protocol: %allopassAPI.network_protocol%
            network_port: %allopassAPI.network_port%
            host: %allopassAPI.host%

```

Route to add
------------

[](#route-to-add)

```
sinenco_allopass_payment:
    resource: '@SinencoAllopassPaymentBundle/Resources/config/routing.yml'
    prefix: /

```

Installation and Update
=======================

[](#installation-and-update)

Images
------

[](#images)

```
php app/console assets:install

```

Update PricePoint
-----------------

[](#update-pricepoint)

When you set all parameters :

```
php app/console allopass:prices:update

```

How to use it
=============

[](#how-to-use-it)

Go to the payment page
----------------------

[](#go-to-the-payment-page)

You need to set the data field for example with an invoice id or a user id

```
$this->generateUrl(
    "sinenco_allopass_payment_prepare", array(
        'data' => 'your data'
    )
)

```

This link redirects to a page on your server (resource from this bundle) where :

- The user choose its country
- Then choose the payment method
- Then, he's redirected to an allopass document generated with the Allopass API

Payment And Event
-----------------

[](#payment-and-event)

When the payment is complete, you have to process the payment with callback actions, and redirect your cutomer with the return url

### The return Url

[](#the-return-url)

Remember, you set à parameter in sinenco.allopass\_payments.return\_route

When a user pay with allopass, he will be redirected to this page. With GET parameters : RECALL, data, code, trxid, transaction\_id. The transaction is not checked with return URL but with callback url so you just have to display the correct page to your customer like the invoice page or a confirmation page.

### Callback Url

[](#callback-url)

This url is secured to process actions. Like add a transaction in an invoice.

This url create an Transaction and an event is dispatched : AllopassPaymentCoreEvents::onAllopassPaymentCallback. The event is a AllopassPaymentCallbackEvent object

The event have the method isFirstTime() to know if the transaction existed before this payment. The event have the method getTransaction() to get a Sinenco\\AllopassPaymentBundle\\Entity\\Transaction entity. This entity is stored before the dispatch.

So you have to create a listener, here is an exemple

#### In services.yml

[](#in-servicesyml)

```
services:
    shop.allopass.listener.callback:
        class: Shop\PaymentBundle\Listeners\AllopassCallbackListener
        arguments:
            entityManager: "@doctrine.orm.entity_manager"
            container: "@service_container"
        tags:
            - { name: kernel.event_listener, event: "sinenco.allopasspayment.callback", method: onCallbackAllopass }

```

#### in Shop\\PaymentBundle\\Listeners\\AllopassCallbackListener

[](#in-shoppaymentbundlelistenersallopasscallbacklistener)

In my example, i set data with an invoice number.

```
