Implement Direct Debit in the shared layer

Edit on GitHub

This document shows how to identify the new payment type using some unique constants. Those constants are defined under the Shared namespace because they’re needed both for Yves and Zed.

To identify the new payment type, do the following:

  1. In the Shared namespace, where you define these unique constants, create the PaymentMethodsConstants interface.

Code sample:

<?php
namespace Pyz\Shared\PaymentMethods;

interface PaymentMethodsConstants
{
	public const PROVIDER = 'PaymentMethods';
	public const PAYMENT_METHOD_DIRECTDEBIT = 'paymentMethodsDirectDebit';
}
  1. Enrich the Payment transfer file with a new property that corresponds to the new Direct Debit payment method.

Code sample:

<?xml version="1.0"?>
<transfers xmlns="spryker:transfer-01"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="spryker:transfer-01 http://static.spryker.com/transfer-01.xsd">

    <transfer name="Payment">
        <property name="paymentMethodsDirectDebit" type="PaymentDirectDebit"/>
    </transfer>

    <transfer name="PaymentDirectDebit">
        <property name="idPaymentDirectDebit" type="int"/>
        <property name="fkSalesOrder" type="int"/>

        <property name="bankAccountHolder" type="string"/>
        <property name="bankAccountBic" type="string"/>
        <property name="bankAccountIban" type="string"/>
    </transfer>
  1. Update PaymentTransfer:
vendor/bin/console transfer:generate

What’s next?

After you’ve completed the frontend, backend, and shared implementation of the Direct Debit payment method, you can test it. For information on how to do that, see Test your Direct Debit implementation