card
card copied to clipboard
Disabling specific card types
I just found this great plugin (thanks!) but I was setting it up and I'm interested in defining which cards are actually supported. I mean they will fail at the gateway if they enter an unsupported card but I would like to just deny the card from the get go. Is this possible? I didn't see a configuration option for this.
Rick, did you ever get a solution for this? I'd like to be able to do the same thing.
Man that was a while ago, let me review the code and I'll let you know what I ended up doing.
Thanks. I'd really appreciate it.
So it looks like I ended up just leaving it to the gateway in this case. However you could easily run the number through a LUHN algorithm to detect the card type before sending it to the gateway in the back end code, however that's not really much better than just letting the gateway fail it.
Another option is to do the LUHN check in javascript. I havent tried, but you could probably do an onsubmit="return validate();"
on the form where you can validate it there... or even on a keyup
event on the card field.
Thanks for the quick response. That was the approach I was working on. Was hoping there might be a way to restrict it built into the plugin.
Would be a nice feature for someone to add :)
Has anyone figured out how do restrict the types of cards that can be entered and pass the validator?
I agree, I am not sure why there is support for 19 numbers for cards. Also can't format the date to MM/YY without third-party mask.
@sgtcoder Have you tried the latest Card 2.5.3 and Payment 2.4.4?
I just removed the 19 digits for Visa here: https://github.com/jessepollak/payment/issues/150