The Home for
Magento Excellence

Explore. Discover. Elevate. #magento

162
Modules Tested
98
Ready for Magento 2.4
64
Need Your Help
Potentially Abandoned v2.0.0
Has Build Issues
May need fixes before use

Customer Group Payments

smaex/customer-group-payments

Restricts payment methods to specific customer groups in Magento 2.

776
Downloads
Below average
15
GitHub Stars
Below average
7y ago
Last Release
0
Open Issues

Quality Score

0/2
Installs via Composer
DI compiles correctly
Templates compile
PHPStan

Recent Test History

Each release is tested against the latest Magento version at that time.

v2.0.0 on Magento 2.4.8-p3
Dec 16, 2025
v2.0.0 on Magento 2.4.8-p2
Aug 14, 2025
v2.0.0 on Magento 2.4.8
May 22, 2025
v2.0.0 on Magento 2.4.7-p4
Feb 15, 2025
v2.0.0 on Magento 2.4.7-p3
Oct 23, 2024
v2.0.0 on Magento 2.4.7-p2
Sep 8, 2024

+4 older tests

GitHub Repository
Source code & docs
Packagist
Version history
Issues & Support
Get help or report bugs

This module needs community help

Composer installation fails. Your contribution could help the entire Magento community!

Help Fix This

Share This Module's Status

Customer Group Payments Magento compatibility status badge

README

Loaded from GitHub

Magento 2: Customer Group Payments

Restricts payment methods to specific customer groups in Magento 2.

Intro

Adding additional checks to payment methods – to decide if a certain payment method is applicable to a certain customer or not – is pretty easy and straight forward in Magento 2.

Magento provides a rather simplistic interface for custom payment method checks, and uses a composite check to process these individual checks. Adding a custom check is therefore just a matter of injecting it into Magento’s composite check via dependency injection.

This extension implements such a custom check to decide if a certain payment method is applicable to a customer based on the customer group, along with a corresponding system configuration field for payment methods.

Screenshot: Magento system configuration field for payment methods that restricts a payment method to selected customer groups.

Prerequisite

Unfortunately, there’s currently a limitation in Magento’s code regarding this mechanism that requires us to use a small workaround, so this extension depends on another extension providing this workaround. See smaex/additional-payment-checks for more information.

How to install

Simply require the extension via Composer.

$ composer require smaex/customer-group-payments ^2.0

Finally, enable the module via Magento’s CLI.

$ magento module:enable Smaex_CustomerGroupPayments

How to use

While the extension provides you with all the tools you need to restrict payment methods to specific customer groups, it doesn’t do anything without some custom configuration on your part. That’s because adding system configuration fields is done via XML configuration in Magento.

To properly configure your payment methods, the best way going forward is probably to set up your own custom module (e.g., Acme_Payment) under app/code.

Declaring a dependency on Magento_Payment and Smaex_CustomerGroupPayments in your module.xml is kinda mandatory, dependencies on other modules like Magento_OfflinePayments depend on the payment methods actually used in your project.

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Acme_Payment" setup_version="1.0.0">
        <sequence>
            <module name="Magento_OfflinePayments"/>
            <module name="Magento_Payment"/>
            <module name="Smaex_CustomerGroupPayments"/>
        </sequence>
    </module>
</config>

The next and already final step is then to provide your own system.xml under etc/adminhtml in your custom module and extend the existing configuration for each payment method used in your project.

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="payment">
            <!--
            Check / Money Order
            -->
            <group id="checkmo">
                <field id="customer_groups" type="multiselect" translate="label comment" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1" sortOrder="52">
                    <include path="Smaex_CustomerGroupPayments::system/customer_groups.xml"/>
                </field>
            </group>
            <!--
            Cash On Delivery Payment
            -->
            <group id="cashondelivery">
                <field id="customer_groups" type="multiselect" translate="label comment" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1" sortOrder="52">
                    <include path="Smaex_CustomerGroupPayments::system/customer_groups.xml"/>
                </field>
            </group>
        </section>
    </system>
</config>

Alternative

If ~~you’re a lazy sloth~~ this looks like too much work (i.e., XML configuration), there’s also another extension tackling the same problem from a very different angle.

We’re hiring!

Wanna work for one of Germany’s leading Magento partners? With agile methods, small teams and big clients? We’re currently looking for experienced ~~masochists~~ PHP & Magento developers in Munich. Sounds interesting? Just drop me a line via j.scherbl@techdivision.com

This content is fetched directly from the module's GitHub repository. We are not the authors of this content and take no responsibility for its accuracy, completeness, or any consequences arising from its use.

Back to All Modules