Payment gateway APIs require the credit card type in request parameters but why prompt users in the UI to select it when Visa, Amex, etc. can be automatically recognized at the time of performing auth or capture? validCreditCard() with $type as input is useful if the CC details are being stored now without pre-auth until a later date when e.g., a subscription renewal occurs. Otherwise let the payment gateway reject the card number.
Payment gateway APIs require the credit card type in request parameters but why prompt users in the UI to select it when Visa, Amex, etc. can be automatically recognized at the time of performing auth or capture?
validCreditCard()
with$type
as input is useful if the CC details are being stored now without pre-auth until a later date when e.g., a subscription renewal occurs. Otherwise let the payment gateway reject the card number.Combined with https://github.com/inacho/php-credit-card-validator/pull/4 this will add credit card recognition so the correct type can be submitted to payment gateway APIs.
For one use case I ended up creating an intermediate wrapper class: