[Creditcard Validation | Example Applications ]


Overview

Web+Validate® is a simple application that determines the type of credit card and validates the card number. Web+Validate® can check and validate all major credit and charge card account numbers, including:

Implementation File

File Name Type Function
validate.wml Template Illustrates creditcard validation


Validate-p.wml


<webSet #HeaderPageTitle# = "CreditCard Validation Example">
<webSet #HeaderBigTitle# = "Web+<sup>&##174;</sup>Creditcard validation Example">
<webSet #dir# = "/secure">
<webSet #CGIPath# = "#path##dir#">
<webInclude Script="#path#/header.wml">
<webInclude Script="#path#/gearbox.wml">


<h3>Overview</h3>

<table width="600">
<tr><td>
Web+Validate&#174; is a simple application that determines
the type of credit card and validates the card number.
Web+Validate&#174; can check and validate all major credit
and charge card account numbers, including:
</td></tr>
<tr> <td>
<ul>
<li>Credit Cards
<ul>
<li>VISA</li>
<li>MasterCard</li>
<li>Discover</li>
</ul></li>
<li> Charge Cards
<ul>
<li>American Express </li>
<li>Diners Club</li>
<li>Carte Blanche</li>
<li>JCB (Japanese Credit Bureau) Card</li>
</ul></li>
</ul>
</td>
</tr>
</table>

<hr />
<webIf #ParameterExists(Submit)#>
<h2>Web+ Credit Card Validation Result</h2>
<webSelectCase #ValidateCC(CardNo)#>
<webCase 0>
<font face="Arial, Helvetica" color="#FF0000"><b>Your credit card is not valid. Please try again!</b></font>
<webCase 1>
<font face="Arial, Helvetica" color="#FF0000">You have just entered a <b>VALID American Express</b> card.</font>
<webCase 2>
<font face="Arial, Helvetica" color="#FF0000">You have just entered a <b>VALID VISA</b> card.</font>
<webCase 3>
<font face="Arial, Helvetica" color="#FF0000">You have just entered a <b>VALID MASTER</b> card.</font>
<webCase 4>
<font face="Arial, Helvetica" color="#FF0000">You have just entered a <b>VALID DISCOVER</b> card.</font>
<webCaseElse>
<font face="Arial, Helvetica" color="#FF0000">You have just entered a <b>VALID</b>, but an <b>UNKNOWN</b> card type.</font>
</webSelectCase>
</webIf>


<form method="post" action="<webPrint>#CGIPath#</webPrint>/validate.wml#result" id="WebpForm_1" onsubmit="return _Webp_checkForm_1(this)">
<table>
<tr>
<td>
<b>Enter Credit Card Number </b> <br/>(Numbers only. Do NOT enter spaces, dashes "-", or other characters):
</td>
<td>
<input type="password" size="20" name="CardNo" />
</td>
</tr>

<!---input type=hidden name="CardNo_required" value="You must enter a Credit Card Number">
<input type=hidden name="CardNo_integer" value="You must enter a valid number for the
Credit Card Number. Please do not enter spaces, dashes (-), or other characters. eg. 1234567890123456"--->

<tr>
<td>
<input type="submit" name="submit" value="Validate Credit Card" />
</td>
<td>
<input type="reset" name="reset" value="Clear" />
</td>
</tr>
</table>
</form>


Validate.wml

<webNoOutput>
<!---
| Description: Examples to illustrate how creditecard works.
|
| CVS History:
| $Log: validate.wml,v $
| Revision 1.1 2006/03/29 02:25:45 vidyar
| adding files
|
| Revision 1.1 2006/03/09 14:54:40 vidyar
| daily commit
|
|
|
--->
<webCall script=#application.FUNCPATH & "/geturl.wml"# destScript="validate.wml" url=#nextURL# byref sessionID=#sessionID#>
</webNoOutput>
<webSet #javascriptFile# = "validate.wml">
<webInclude script=#application.SCRIPTPATH & "/template.wml"#>

 

Copyright © 2009 Webplus, Inc. (talentsoft). All Rights Reserved.
webmaster@webplus.com