views:

79

answers:

2

I have payment gateway integration in my application developed using .Net Compact framework 3.5.

Is there any "Credit card validation and parsing utilities" that i can use in my application or is there any class that i can use to identify the type of the card?

+4  A: 

Google for Lunn or Luhn validation. This will simply validate that the cc number is a valid sequence, but you will need to obviously validate that against the provider.

The same links may provide you with the prefixes used by several card companies.

leppie
For more googling the prefix lists are called "BIN lists" (bank id number)
Alex K.
A: 

Try Subsonic.Sugar .. then you could do somethign like this

 protected void ValidateCardServerValidate(object source, ServerValidateEventArgs args)

{ bool cardValidate; string item = ddlCardType.SelectedItem.Text.ToUpper();

if (item == "MASTERCARD")
  cardValidate = SubSonic.Sugar.Validation.IsCreditCardMasterCard(args.Value);
else if (item == "VISA")
  cardValidate = SubSonic.Sugar.Validation.IsCreditCardVisa(args.Value);
else if (item == "ACME")
  cardValidate = SubSonic.Sugar.Validation.IsCreditCardDinersClub(args.Value);
else if (item == "DINERS")
  cardValidate = SubSonic.Sugar.Validation.IsCreditCardAmericanExpress(args.Value);
else
  cardValidate = SubSonic.Sugar.Validation.IsCreditCardAny(args.Value);

args.IsValid = cardValidate;

}

elsharpo