Before submitting a credit card to a payment gateway it's important that we run some sanity checks on the number.
A common check that is performed upfront is to validate the card type based on the starting digits and length of card number. The main patterns that we care about are as follows:
+============+=============+===============+
| Card Type | Begins With | Number Length |