Implement invoice payment in shared layer

Edit on GitHub

This tutorial helps you identify the new payment type through some unique constants. Those constants are going to be defined in the Shared namespace, since they’re needed both by Yves and Zed.

  1. Create the PaymentMethodsConstants interface under the Shared namespace, where you define these unique constants.
Code sample:

namespace Pyz\Shared\PaymentMethods;

interface PaymentMethodsConstants

     * @const string
    const PROVIDER = 'paymentmethods';

     * @const string
    const PAYMENT_METHOD_INVOICE = 'invoice';

     * @const string

  1. Enrich the Payment transfer file with a new property that corresponds to the new payment method. Add Shared/PaymentMethods/Transfer/invoicepayment.transfer.xml file with the following content:
Code sample:
<?xml version="1.0"?>
<transfers xmlns="spryker:transfer-01"

    <transfer name="Payment">
        <!-- Should be equal to PaymentMethodsConstants::PAYMENT_INVOICE_FORM_PROPERTY_PATH.
		Then the form fields can be automatically mapped to the transfer object inside this field. -->
        <property name="paymentmethodsinvoice" type="string"/>
  1. Update the PaymentTransfer class:
vendor/bin/console transfer:generate