cancel
Showing results for 
Search instead for 
Did you mean: 

Magento Discover credit card validation failing

Magento Discover credit card validation failing

We have a Magento 2.3 site that accepts credit cards. Discover is going to be issuing fines to merchants that are not set up to allow these additional card number ranges to be accepted on their sites. They have tested this site and it failed. They want to accept credit card numbers in the range 14 -16 digits. I have tried to modify the credit card validation in Magento, but couldn't find which script is validation it. I tried with vendor\magento\magento2-base\lib\web\mage\validation.js, vendor\magento\magento2-base\lib\web\prototype\validation.js and vendor\magento\module-ui\view\base\web\js\lib\validation\rules.js but the changes in these files are not reflecting on frontend. Which file I need to modify to change the credit card validation? Please help.

2 REPLIES 2

Re: Magento Discover credit card validation failing

Hello @akhilesh4u66f7 

 

To modify the credit card validation in Magento 2.3, you need to modify the credit-card-validation.js file located at vendor/magento/module-checkout/view/frontend/web/js/view/payment/. This file is responsible for handling the credit card validation on the checkout page.

 

To make the necessary changes, you should create a custom module and override this file by placing it in your module's directory at app/code/[Vendor]/[Module]/view/frontend/web/js/view/payment/credit-card-validation.js.

 

In your custom file, you can modify the validation rules for credit card numbers as needed. Be sure to properly test your changes before deploying them to your production environment.

Once you have made your changes, you may need to clear the cache and deploy static content for the changes to take effect.

 

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now

Re: Magento Discover credit card validation failing

@theMageComp There is no credit-card-validation.js file in that folder. There are only three files in that folder default.js, email-validator.js, and list.js.