Skip to content

Payout gateways

In the following example, a new gateway will be configured.

  1. Create a new vendor payment gateway and add its configuration
php
<?php
// src/Form/Type/Payout/ExampleGatewayConfigurationType.php

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

final class ExampleGatewayConfigurationType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        // your own configuration
    }
}
yml
# config/services.yaml
app.form.type.payout.gateway_configuration.example:
    class: App\Form\Type\Payout\ExampleGatewayConfigurationType
    tags:
        - { name: odiseo_marketplace.payout.gateway_configuration_type, type: example, label: Example }
        - { name: form.type }

The tag also accepts an optional connect_route attribute. If your gateway has its own onboarding flow (e.g. an OAuth "Connect" redirect, like the Stripe gateway in the marketplace-payments-pro subplugin), set it to that route's name and the seller panel's gateway dropdown links there instead of the generic "create payout method" form:

yml
tags:
    - { name: odiseo_marketplace.payout.gateway_configuration_type, type: example, label: Example, connect_route: app_example_connect_oauth_link }
  1. Set up a service for handling the new payout gateway
php
<?php
// src/Payout/Gateway/ExamplePayoutGateway.php

use Odiseo\SyliusMarketplacePlugin\Entity\VendorPaymentInterface;
use Odiseo\SyliusMarketplacePlugin\Payout\Gateway\PayoutGatewayInterface;

final class ExamplePayoutGateway implements PayoutGatewayInterface
{
    public function pay(VendorPaymentInterface $payment): void
    {
        // your own logic

        $payment->setDetails([]);
    }
}
yml
# config/services.yaml
app.payout.gateway.payout_gateway.example:
    class: App\Payout\Gateway\ExamplePayoutGateway
    tags:
        - { name: 'odiseo_marketplace.payout.gateway.payout_gateway_handler', key: 'example' }

by Odiseo