Manual Installation

Plugin requirements

Installation steps

1. Require plugin

composer require sylius/adyen-plugin:"^2.0@alpha" --no-scripts

2. Enable the Bundle

# config/bundles.php

return [
    ...
    Sylius\AdyenPlugin\SyliusAdyenPlugin::class => ['all' => true],
];

3. Import Configuration

# config/packages/_sylius.yaml

imports:
    ...
    - { resource: "@SyliusAdyenPlugin/config/config.yaml" }

parameters:
    ...
    sylius_refund.supported_gateways:
        - offline
        - adyen

4. Import routes

# config/routes.yaml

...
sylius_adyen_plugin:
    resource: "@SyliusAdyenPlugin/config/routes.yaml"

5. Extend the ProductVariant entity

<?php
// src/Entity/Product/ProductVariant.php

declare(strict_types=1);

namespace App\Entity\Product;

use Doctrine\ORM\Mapping as ORM;
use Sylius\AdyenPlugin\Entity\CommodityCodeAwareInterface;
use Sylius\AdyenPlugin\Entity\CommodityCodeAwareTrait;
use Sylius\Component\Core\Model\ProductVariant as BaseProductVariant;
use Sylius\Component\Product\Model\ProductVariantInterface;

#[ORM\Entity]
#[ORM\Table(name: 'sylius_product_variant')]
class ProductVariant extends BaseProductVariant implements CommodityCodeAwareInterface
{
    use CommodityCodeAwareTrait;
}

Register the ProductVariant entity

# config/packages/sylius.yaml
sylius_product:
    resources:
        ...
        product_variant:
            classes:
                model: App\Entity\Product\ProductVariant

6. Import plugin assets

// assets/admin/entrypoint.js

...
import '../../vendor/sylius/adyen-plugin/assets/admin/entrypoint';
// assets/shop/entrypoint.js

...
import '../../vendor/sylius/adyen-plugin/assets/shop/entrypoint';

7. Install assets

bin/console assets:install public

8. Install and build frontend dependencies

yarn add @adyen/adyen-web@^6.22.0
yarn install
yarn encore dev  # or yarn encore prod

9. Run database migrations

bin/console doctrine:migrations:migrate

10. Clear cache

bin/console cache:clear

[Optional] Route Adyen logs to specific handlers

The plugin comes with the adyen monolog channel preconfigured, if you want you can route the logs generated to a specific handler by environment

# config/packages/monolog.yaml
when@dev:
  monolog:
    handlers:
      adyen_file:
        type: rotating_file
        path: '%kernel.logs_dir%/adyen-dev.log'
        max_files: 14
        level: debug
        channels: ['adyen']

when@prod:
  monolog:
    handlers:
      adyen_file:
        type: rotating_file
        path: '%kernel.logs_dir%/adyen-%kernel.environment%.log'
        max_files: 30
        level: info
        channels: ['adyen']

Next steps

Once the plugin is installed, don’t forget to configure at least one Sylius payment method that uses Adyen as the gateway.

Follow the guide here: Configuring Adyen Payment Method

This step is required to make Adyen payment options available during checkout.

Was this helpful?