Does the Luhn algorithm work for all mainstream credit cards? (Discover, Visa, Mastercard, Amex)

后端 未结 3 1082
生来不讨喜
生来不讨喜 2021-01-03 23:12

Reference: Luhn Algorithm

The Luhn Algorithm is a great way to quickly verify that the user typed their CC # in correctly.

However, I am concerned that there

3条回答
  •  一生所求
    2021-01-03 23:38

    Yes -- it works for all mainstream card types.

    I have a custom PHP class to handle card data that was compiled from various "validate card number" and alike functions from few programming languages + information from Wikipedia & some Payment Processing systems. It successfully validates test card numbers (every payment system has few of such numbers) for these card types:

    • VISA debit / credit
    • VISA Electron
    • VISA Delta
    • MasterCard
    • AMEX
    • Maestro
    • Switch
    • Solo
    • Diners Club
    • Discover
    • JCB

提交回复
热议问题