4D Payments SDK 2016 .NET Edition

Questions / Feedback?

ValidateCard Method

Checks the card number and expiration date for validity.


public void ValidateCard();
Public Sub ValidateCard()


This method performs several checks on customer information to determine if the card information submitted could be valid. This should be done before submitting an actual transaction for authorization. The tests performed are listed below:

Luhn Digit CheckThe Global Transport Server checks the digits of the CardNumber to make sure that it could be a valid card number. The result of this check is stored in the DigitCheckPassed property.
Card Type CheckThe beginning digits of the CardNumber are compared to a BIN range by the Global Transport Server to determine if it is a valid card type. The result of this check is stored in the CardTypeDescription property. (the CardType is determined by the component, not by Global Payments).
Expiration Date CheckThe date given in CardExpMonth and CardExpYear is checked by the Global Transport Server to make sure that the card is still valid. The DateCheckPassed property is populated with the result.
Length CheckIndicates whether the CardNumber's length is appropriate for the card's prefix, and stores the results in the LengthCheckPassed property.

This component will query the Global Transport Server to perform the above checks. The UserId and Password is only required for the GetDebitNetworkInfo method, neither IsCommercialCard or ValidateCard require authentication to use. The first three checks made by the ValidateCard method may also be performed off-line by setting the ValidationMode configuration setting to "Local" instead of "Global". In this case, the mod-10 check will be computed mathematically by the component, and the expiration date will be checked against the current system time. The CardTypeDescription will be computed using an internal set of rules, but do note that these will not be as up-to-date as the rules the Global Payments Server uses. The length check will only be performed when ValidationMode is set to "Global" mode.

Copyright (c) 2021 4D Payments Inc. - All rights reserved.
4D Payments SDK 2016 .NET Edition - Version 16.0 [Build 8017]