jroszkiewicz/payum-adyen

Adyen gateway for Payum

v2.0 2016-12-06 10:26 UTC

This package is auto-updated.

Last update: 2024-10-28 13:43:33 UTC


README

Build Status

The Payum extension for Adyen.

Instalation

The preferred way to install the library is using composer.

Run:

php composer.phar require "jroszkiewicz/payum-adyen"

Configuration

<?php
// configure.php
use Payum\Core\GatewayFactoryInterface;
use Payum\Core\Model\Payment;
use Payum\Core\PayumBuilder;

$paymentClass = Payment::class;
$gatewayName = 'adyen';

$defaultConfig = [
    'factory' => $gatewayName,
    'sandbox' => true,
    // Spec
    'skinCode' => '',
    'merchantAccount' => '',
    'hmacKey' => '',
];

$payum = (new PayumBuilder())
    ->addGatewayFactory($gatewayName, function(array $config, GatewayFactoryInterface $coreGatewayFactory) {
        return new \Payum\Adyen\AdyenGatewayFactory($config, $coreGatewayFactory);
    })

    ->addGateway($gatewayName, $defaultConfig);

    ->getPayum()
;

Symfony Integration (payum-bundle < 2.0)

Add AdyenGatewayFactory to payum:

<?php
// src/Acme/PaymentBundle/AcmePaymentBundle.php

namespace Acme\PaymentBundle;

use Payum\Adyen\Bridge\Symfony\AdyenGatewayFactory;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class AcmePaymentBundle extends Bundle
{
    public function build(ContainerBuilder $container)
    {
        parent::build($container);

        $extension = $container->getExtension('paum');
        $extension->addPaymentFactory(new AdyenGatewayFactory());
    }
}

Configuration in config.yml:

You should remember that HMAC is SHA-256 (SHA-1 is deprecated).

payum:
    gateways:
        adyen_gateway:
            adyen:
                sandbox: true
                skinCode: ADYEN_SKINCODE
                merchantAccount: ADYEN_ACCOUNT
                hmacKey: SECRET_KEY
                notification_method: basic
                default_payment_fields:
                    shopperLocale: de

Symfony Integration (payum-bundle >= 2.0)

Add AdyenGatewayFactory to payum in services.yml:

    adyen_gateway:
        class: Payum\Core\Bridge\Symfony\Builder\GatewayFactoryBuilder
        arguments: [Payum\Adyen\AdyenGatewayFactory]
        tags:
            - { name: payum.gateway_factory_builder, factory: adyen_gateway }

Configuration in config.yml:

You should remember that HMAC is SHA-256 (SHA-1 is deprecated).

payum:
    gateways:
        adyen_gateway:
            factory: adyen
            sandbox: true
            skinCode: ADYEN_SKINCODE
            merchantAccount: ADYEN_ACCOUNT
            hmacKey: SECRET_KEY
            notification_method: basic
            default_payment_fields:
                shopperLocale: de

Resources

License

Copyright 2021 Jakub Roszkiewicz Copyright 2016 PIXERS Ltd - www.pixersize.com

Licensed under the BSD 3-Clause