I just did this in C# Mike. First things first; the things that bit me...
1. Order your SSL certificate.
2. Get your merchant account.
3. Choose a payment gateway.
Also stay away from Pay Pal Pro. This is a new pay pal offering that lets you
do real time credit card transaction without the merchant account or gateway
via web services. Sounds good on paper but the docs are terrible, service and
help non-existent. This will be good once it matures.
I used Authorize.Net for a gateway and they provided me with an API and
tutorial. There isn't a "Script" to download because it is different depending
on the different gateways. Once you choose one you will have a better
understanding of the task. I would recommend Verisign and Authorize.net. As
for credit card validation prior to sending it to the gateway...
These are the two things I use to do Credit Card Validation... Keep in mind
this means it CAN be a valid credit card number not that it is. Also This
isn't my code and I want to give credit where credit is due... but I don't know
who wrote it; I have been using it for a while and made some mods to it.
using System;
using System.Web.UI.WebControls;
namespace CustomValidators {
/// <summary>
/// Summary description for Class1.
/// </summary>
//-- This is allowing us to inherit the BaseValidator's functionality
public class CreditCardValidator : BaseValidator {
protected override bool EvaluateIsValid() {
//-- Set valueToValidate to the validation control's
controltovalidate value.
string valueToValidate =
this.GetControlValidationValue(this.ControlToValidate);
int indicator = 1; //-- will be indicator for every
other number
int firstNumToAdd = 0; //-- will be used to store sum
of first set of numbers
int secondNumToAdd = 0; //-- will be used to store
second set of numbers
string num1; //-- will be used if every other number
added is greater
//-- than 10, store the left-most integer here
string num2; //-- will be used if ever yother number
added
//-- is greater than 10, store the right-most integer
here
//-- Convert our creditNo string to a char array
char[] ccArr = valueToValidate.ToCharArray();
for (int i = ccArr.Length - 1; i >= 0; i--) {
char ccNoAdd = ccArr[i];
int ccAdd = Int32.Parse(ccNoAdd.ToString());
if (indicator == 1) {
//-- If we are on the odd number of
numbers, add that number to our total
firstNumToAdd += ccAdd;
//-- set our indicator to 0 so that our
code will know to skip to the next piece
indicator = 0;
}
else {
//-- if the current integer doubled is
greater than 10
//-- split the sum in to two integers
and add them together
//-- we then add it to our total here
if ((ccAdd + ccAdd) >= 10) {
int temporary = (ccAdd + ccAdd);
num1 =
temporary.ToString().Substring(0, 1);
num2 =
temporary.ToString().Substring(1, 1);
secondNumToAdd +=
(Convert.ToInt32(num1) + Convert.ToInt32(num2));
}
else {
//-- otherwise, just add them
together and add them to our total
secondNumToAdd += ccAdd + ccAdd;
}
//-- set our indicator to 1 so for the
next integer
//-- we will perform a different set of
code
indicator = 1;
}
}
//-- If the sum of our 2 numbers is divisible by 10,
//-- then the card is valid. Otherwise, it is not
bool isValid = false;
if ((firstNumToAdd + secondNumToAdd)%10 == 0)
isValid = true;
else
isValid = false;
return isValid;
}
}
}
using System;
namespace CustomValidators {
/// <summary>
/// Summary description for CreditCard2.
/// </summary>
public class CreditCardvalidation {
public CreditCardvalidation() {}
private bool ValidateCC(string creditNo) {
int indicator = 1; //-- will be indicator for every
other number
int firstNumToAdd = 0; //-- will be used to store sum
of first set of numbers
int secondNumToAdd = 0; //-- will be used to store
second set of numbers
string num1; //-- will be used if every other number
added is greater than 10,
//-- store the left-most integer here
string num2; //-- will be used if ever yother number
added is greater than 10,
//-- store the right-most integer here
//-- Convert our creditNo string to a char array
char[] ccArr = creditNo.ToCharArray();
for (int i = ccArr.Length - 1; i >= 0; i--) {
char ccNoAdd = ccArr[i];
int ccAdd = Int32.Parse(ccNoAdd.ToString());
if (indicator == 1) {
//-- If we are on the odd number of
numbers,
//-- add that number to our total
firstNumToAdd += ccAdd;
//-- set our indicator to 0 so that our
code will
//-- know to skip to the next piece
indicator = 0;
}
else {
//-- if the current integer doubled is
greater than 10
//-- split the sum in to two integers
and add them together
//-- we then add it to our total here
if ((ccAdd + ccAdd) >= 10) {
int temporary = (ccAdd + ccAdd);
num1 =
temporary.ToString().Substring(0, 1);
num2 =
temporary.ToString().Substring(1, 1);
secondNumToAdd +=
(Convert.ToInt32(num1) + Convert.ToInt32(num2));
}
else {
//-- otherwise, just add them
together and add them to our total
secondNumToAdd += ccAdd + ccAdd;
}
//-- set our indicator to 1 so for the
next
//-- integer we will perform a
different set of code
indicator = 1;
}
}
//-- If the sum of our 2 numbers is divisible by 10,
//-- then the card is valid. Otherwise, it is not
bool isValid = false;
if ((firstNumToAdd + secondNumToAdd)%10 == 0)
isValid = true;
else
isValid = false;
return isValid;
}
}
}
Travis D. Falls | Consultant RAFT.Net IT | 860.547.4070 | [EMAIL PROTECTED]
-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] Behalf Of Mike Belcher
Sent: Monday, November 21, 2005 11:17 AM
To: [email protected]
Subject: [AspNetAnyQuestionIsOk] Credit Card Processing
Credit card processing in asp.net in Vb.net language. I have seen most
websites do this and take an order via a form and then process it. Is there
a script out there that does this and a place to learn how this all works?
Thanks.
Mike
Yahoo! Groups Links
*************************************************************************
This communication, including attachments, is
for the exclusive use of addressee and may contain proprietary,
confidential and/or privileged information. If you are not the intended
recipient, any use, copying, disclosure, dissemination or distribution is
strictly prohibited. If you are not the intended recipient, please notify
the sender immediately by return e-mail, delete this communication and
destroy all copies.
*************************************************************************
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/