|
Call MatchDebitCardDetails serviceTo match debit cards, you need to call MatchDebitCardDetails, supplying the PAN, expiry date and sort code. Get validation responseTo find out whether the card passed validation, you need to retrieve the validation response. Are there any errors?If the card failed validation, card conditions are returned. Therefore to see if there were validation errors you need to check whether CardCondition contains any information.
![]() if (response.CardValidationResponse.CardConditions != null) If there are errors you need to extract the codes and any returned reasons to determine why the card details failed validation. Not every code has an associated reason.
![]() foreach(var CardCondition in response.CardValidationResponse.CardCondition) Console.WriteLine("Card validation failed with code: (0) Severity: (1) Reason: (2)") CardCondition.Code, CardCondition.Severity, CardCondition.Reason); Get match resultTo find out whether the debit card issuer matched the bank associated with the sort code, you need to retrieve the match result. |
The match is successful if BankMatch or BankGroupMatch is returned.
The match failed if NoMatch is returned. This means the match was performed but no match was found.
If UnableToMatch is returned, the match could not be performed. This could be either because matching is not available for this card, or because the card failed validation and so the details could not be checked.
If the validation was successful or the BIN exists, details about the card are returned. Your business requirements will determine which of these details you need.
if (response.CardValidationResponse.CardType.HasValue)
Console.WriteLine("Card type => {0}", Enum.GetName(typeof(TypeOfCard), response.CardValidationResponse.CardType.Value));
if (response.CardValidationResponse.SubType.HasValue)
Console.WriteLine("Card sub-type => {0}", Enum.GetName(typeof(SubTypeOfCard), response.CardValidationResponse.SubType.Value));
if (!string.IsNullOrEmpty(response.CardValidationResponse.IssuerName))
Console.WriteLine("Card issuer => {0}", response.CardValidationResponse.IssuerName);
if (!string.IsNullOrEmpty(response.CardValidationResponse.SchemeName))
Console.WriteLine("Card scheme => {0}", response.CardValidationResponse.SchemeName);
if (response.MatchResult != null)
Console.WriteLine("Debit card match response => {0}", Enum.GetName(typeof(MatchResult), response.MatchResult.Value));
Your application should interpret the validation results and display messages suitable for your users. For example, when code 4 is returned with no reason code, your application could display "The Card Number failed validation".