Fortunately, credit card numbers are created in a way that allows for some basic verification.
This verification does not tell you if funds are available on the account and it certainly doesn’t tell whether or not the person submitting the order is committing credit card fraud.
In fact, It’s possible that the card number is mistyped in such a way that it just happens to pass verification.
But it does catch most typing errors and reduces bandwidth by catching those errors before trying to actually process the credit card.
To validate a credit card number, you start by adding the value of every other digit, starting from the right-most digit and working left.