One of our clients asked to update the sort order of credit card type of the Magento 2 custom payment module. The reason is that they want to display a specific credit card logo in the first position, like displaying the VISA logo. If you are looking to do the same, then this blog post by Dhairvi Solutions will help you.
Why Modify Credit Card Type Sequence?
There are several reasons you might want to change the order of credit card types:
- Prioritize the most common payment methods
- Align with regional payment preferences
- Improve checkout flow and user experience
- Highlight preferred credit card partnerships
- Improved Conversion Rates
Step-by-Step Guide to Change the Sequence of Credit Card Types in Magento 2
Assume you want to display VISA in the first position on the Magento 2 checkout page.

Step 1: Copy magento default payment.xml file from \vendor\magento\module-payment\etc\
Step 2: Paste the copied payment.xml file to your custom module.
E.g., /app/code/Dhairvi/Demo/etc/payment.xml
Step 3: Update the “order” attribute of the payment.xml file as per your business requirement.
E.g., I want to display credit card types in this order. VISA, MasterCard, American Express and then all others as it is. So, the following is what I have to update in the payment.xml file., and then all others are as they are

This change will update the sequence of credit card type at front-end checkout as well as in the admin. Check the following screenshot of the admin.

Although Magento 2 doesn’t provide a simple method for rearranging credit card kinds via the admin panel, you can easily alter the order to better meet your company’s requirements and enhance the clientele’s experience.
Dhairvi Solutions offers professional Magento 2 development services if you require assistance implementing these modifications. Our team of experts is prepared to assist you in taking your Magento 2 store to the next level, whether your goal is to enhance overall store functionality, optimize checkout procedures, or personalize payment choices.

