This page has moved and will be redirected soon. See Migrated topics for the complete list.
The Payment Provider Gateway documentation uses the Magento 2.3 (now Adobe Commerce and Magento Open Source) of the Braintree module as a reference application. The Braintree module was removed in version 2.4.0. The concepts described in this guide are still applicable to version 2.4.0, but the code samples are not supported.

Payment method module configuration

For the sake of compatibility, upgradability and easy maintenance, do not edit the default Magento code; add your customizations in a separate module.

You can use the sample Magento_SamplePaymentGateway module files as the basis for your custom module structure and files. However, be aware that this code is NOT supported.

Specify your module dependencies

Your custom payment integration module must have at least the following dependencies:

  • Magento_Sales module: to be able to get order details
  • Magento_Payment module: to use the Magento payment provider gateway infrastructure
  • Magento_Checkout module: to be able to add the new payment method to checkout. If you do not plan to use it on the storefront checkout, this dependency is not required.

Specify these dependencies in your composer.json and module.xml files.

composer.json

In your %Vendor_Module%/composer.json file, specify the dependencies like in the following example:

1
2
3
4
5
6
7
8
9
10
11
12
{
    ...
    "require": {
        ...
        "magento/module-payment": "100.1.*",
        "magento/module-checkout": "100.1.*",
        "magento/module-sales": "100.1.*",
        ...
    },
    ...

}

For details about composer.json see The composer.json file topic.

module.xml

Add the same dependencies in %Vendor_Module%/etc/module.xml like in the following example:

1
2
3
4
5
6
7
8
9
10
11
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_Module" setup_version="2.0.0">
        <sequence>
            ...
            <module name="Magento_Sales"/>
            <module name="Magento_Payment"/>
            <module name="Magento_Checkout"/>
            ...
        </sequence>
    </module>
</config>

Your payment method implementation might require adding more dependencies.

What’s next

Payment method configuration.