Repository navigation
Installation
Seven steps, in order. Steps 4 and 5 are the ones most often skipped — without them refunds and saved cards fail at runtime rather than at install time.
Before you start, check the requirements: a Payplug account with your payment methods activated, a publicly reachable shop, and wkhtmltopdf if you want refunds.
composer config extra.symfony.allow-contrib true
composer require payplug/sylius-payplug-plugincomposer recipes:install payplug/sylius-payplug-plugin --forceRegisters the bundle, copies the configuration files, and — on Sylius 2.1+ — sets up the plugin's assets.
bin/console doctrine:migrations:migrateThe plugin ships its own migrations: the saved-cards table, the refund history the back office reads, and the operation log used by Hosted Fields.
In config/services.yaml:
parameters:
sylius_refund.supported_gateways:
- payplug
- payplug_oney
- payplug_bancontact
- payplug_apple_pay
- payplug_american_express
- payplug_scalapay
- payplug_weroList every gateway you plan to use. A gateway missing here produces payments the Refund Plugin will not refund through Payplug — and nothing warns you until a customer asks for their money back.
The plugin ships no entity mappings of its own; it extends yours. All three traits are required.
App\Entity\Customer\Customer — the customer's saved cards:
<?php
declare(strict_types=1);
namespace App\Entity\Customer;
use Doctrine\ORM\Mapping as ORM;
use PayPlug\SyliusPayPlugPlugin\Entity\CardsOwnerInterface;
use PayPlug\SyliusPayPlugPlugin\Entity\Traits\CustomerTrait;
use Sylius\Component\Core\Model\Customer as BaseCustomer;
#[ORM\Entity]
#[ORM\Table(name: 'sylius_customer')]
class Customer extends BaseCustomer implements CardsOwnerInterface
{
use CustomerTrait;
}App\Entity\Payment\PaymentMethod — the gateway configuration, including the connection to your
Payplug account:
<?php
declare(strict_types=1);
namespace App\Entity\Payment;
use Doctrine\ORM\Mapping as ORM;
use PayPlug\SyliusPayPlugPlugin\Entity\Traits\PaymentMethodTrait;
use Sylius\Component\Core\Model\PaymentMethod as BasePaymentMethod;
use Sylius\Component\Payment\Model\PaymentMethodTranslationInterface;
#[ORM\Entity]
#[ORM\Table(name: 'sylius_payment_method')]
class PaymentMethod extends BasePaymentMethod
{
use PaymentMethodTrait;
protected function createTranslation(): PaymentMethodTranslationInterface
{
return new PaymentMethodTranslation();
}
}App\Entity\Payment\Payment — the refund history:
<?php
declare(strict_types=1);
namespace App\Entity\Payment;
use Doctrine\ORM\Mapping as ORM;
use PayPlug\SyliusPayPlugPlugin\Entity\Traits\PaymentTrait;
use Sylius\Component\Core\Model\Payment as BasePayment;
#[ORM\Entity]
#[ORM\Table(name: 'sylius_payment')]
class Payment extends BasePayment
{
use PaymentTrait;
}bin/console translation:extract en PayPlugSyliusPayPlugPlugin --dump-messages
bin/console translation:extract fr PayPlugSyliusPayPlugPlugin --dump-messagesThe plugin ships English, French and Italian.
bin/console cache:clearYou are ready to configure a payment method.
-
composer require payplug/sylius-payplug-pluginand the Flex recipe installed - Migrations run
- Every gateway you use listed in
sylius_refund.supported_gateways - All three entity traits applied —
Customer,PaymentMethod,Payment - Translations extracted, cache cleared
- Shop reachable from the internet over HTTPS
-
/payplug/v2/ipnregistered with Payplug, if you use Hosted Fields -
payplugMonolog channel captured in production — see Webhooks and logging
Next: Configuration.
Official Payplug payment plugin for Sylius
Get started
Guides
Operate