validateCreditCardEx
Validates a Credit Card Number. This function that also checks start and expiry dates and also the issue number,
For a simpler credit card number only validation function see validateCreditCard.
Syntax:
validateCreditCardEx (string keycode, string cardnumber, string startMonth, string startYear, string expMonth, string expYear, string issueNumber )
Field
Explanation
Examples
startMonth
The month that the card becomes valid if
applicable, otherwise null ("")
5,05,May
startYear
The year that the card becomes valid if
applicable, otherwise null ("")
2008,08
expMonth
The month that the card
expires.
9,09,SEP
expYear
The year that the card
expires.
2008,08
issueNumber
The Card Issue Number if applicable,
otherwise null ("")
2
Notes and usage guidelines
validateCreditCard is a simple check that the card number is valid.
A valid credit card number is defined as a number that passes the credit card mathematical algorithm check. On its own validateCreditCardEx does not check that the card is a real credit card or that the card has been lost, stolen or involved in fraud.
Returned
data
An object creditcard containing the following fields:
String
‘Invalid’ if the card number is not valid.
Name
Description
cardNumber
The card number of the card to be
validated.
validity
String
‘Valid’ if the card number is valid.
issuer
The card issuer - the financial institution that
provided the card to be validated.
cardScheme
The scheme (eg Visa, Mastercard) that the card
being validated belongs to.
productType
The type of card as determined by the
issuer.
usage
The prescribed usage of the card being
validated
switchIssue
String ‘TRUE’ if the card has an issue number,
otherwise null
switchIssueLength
If the card being validated includes an issue
number then the number of digits in the issue number is in this
field.
switchStandardCard
reserved
panLength
The length of the PAN
binType
notes
Special notes and instructions that accompany some
cards.
majorIndustryIndicator
A description of the Industry category of the card
issuer.
StsNotCorD
reserved
StsNotList
reserved
StsBadCard
reserved
errorCode
If an error occurs during processing the
error number will be here. See the error section for more
details.
errorText
If an error occurs during processing the error
textually description will be here. See the error section for more
details.
Supported Versions
Validate Web Service Version 1.x
Errors
1234 | Card Number is null |
1235 | Card Number is not numeric |
1236 | Card Number is not a valid credit card number |
1237 | Invalid Card Number Length |
1238 | Card Number error |
1239 | Invalid Expiry Date |
1240 | Invalid Start Date |
1241 | Invalid Issue Number |
1242 | Card has expired |
1243 | Card not yet in valid date range |
1244 | Incorrect number of Issue digits |
1245 | Missing Issue number |
Example
Code
Note: We obviously cannot print a real credit card number in this guide and so we use a test number from Visa '4111 1111 1111 1111'. This is technically a correct credit card number and so validity will be returned as valid. However all other information such as Issuer, card scheme, etc will be returned as not found.
c#
The following sample show how to use the validateCreditCardEx function
using c#.
As with all
examples, please see the section Adding a reference to
the Validate Web Service .
c# Example 1 validate.validate wsObject = new validate.validate();
validate.creditcard cardObject =
wsObject.validateCreditCardEx("qwerty", "4111 1111 1111 1111", "Feb", "2008", "1", "07", "");
c# Example 2 using
validate.validate wsObject = new validate.validate(); }
using
System.Collections.Generic;
using System.Text;
namespace validateCreditCardEx
{
class Program
{
static
void
Main(string[] args)
{
string keycode = "qwerty";
string
cardNumber = "4111 1111 1111
1111"; // a valid
Visa test number
string expMonth
= "Feb";
// Using 3 letter
month
string expYear =
"2008"; // using 4 digit year
string startMonth = "1"; // Using
numeric month
string startYear
= "07"; // Using 2 digit year
string issue="1";
validate.creditcard cardObject =
wsObject.validateCreditCardEx
(keycode, cardNumber, startMonth, startYear,
expMonth, expYear, issue);
Console.WriteLine(cardObject.errorCode);
Console.WriteLine(cardObject.errorText);
Console.ReadLine();
}
}
Visual Basic .net
The following sample show how to use the validateCreditCardEx function
using c#.
As wilth all
examples, please see the section Adding a reference to
the Validate Web Service .
Visual Basic.net Example Module Module1Sub Main() ' define the keycode, etc Dim keycode As String = "qwerty" Dim cardNumber As String = "4111 1111 1111 1111" Dim expMonth As String = "2" Dim expYear As String = "10" Dim startMonth As String = "1" Dim startYear As String = "2007" Dim issue As String = "2" ' Create a web service object Dim wsobject As New validate.validate() ' create a creditcard object for the returning data Dim cardObject As validate.creditcard ' Call the web service function cardObject = wsobject.validateCreditCardEx(keycode, cardNumber, startMonth, startYear, expMonth, expYear, issue) ' display the result or the error message Console.WriteLine(cardObject.validity) Console.WriteLine(cardObject.errorCode) Console.WriteLine(cardObject.errorText) Console.ReadLine() End Sub End Module |
Java
The following sample show how to use the validateCreditCardEx function
using Java.
Java Example 1
package validatecreditcardex; public class Main { public static void main(String[] args) {
validate.Validate service = new
validate.Validate(); java.lang.String
keyCode = "qwerty"
;
validate.Creditcard result = port.validateCreditCardEx(keyCode,
cardNumber, startMonth, startYear, expMonth, expYear,
issue); |
XML Messages
Below is a typical XML message request
<?
xml version="1.0" encoding="utf-8"?>Below is a typical XML message response
<?
xml version="1.0" encoding="utf-8"?>