The following is a quick overview of the primary classes that are used to accept credit cards from any .NET language. For much more detailed, check out MSDN-style documentation
Classes
There are 3 classes that you will use often:
- MinimumCreditCard
- Transaction - To see the properties on this one, go to the MSDN-style documentation.
- Response
MinimumCreditCard and Transaction each come in 2 flavors: Standard and Fluent. While you could use both flavors interchangably, it is best just to pick which syntax you prefer and stick with that.
MinimumCreditCard simply exposes a very small subset of the the properties that are available on Transaction. I recommend using MinimumCreditCard all the time and only accessing the additional properties if you need to:
MinimumCreditCard authNet = new MinimumCreditCard()
authNet.Login ("testdrive")
authNet.TranKey("TRANSACTION_KEY")
authNet.Type(TranType.AUTH_CAPTURE)
authNet.CardNum(_cardNumField.Text)
authNet.ExpDate(_cardExpField.Text)
authNet.CardCode(_cardCodeField.Text)
authNet.Amount(8.00);
authNet.Transaction.DriversLicenseNumber("1234567890")
authNet.Transaction.DriversLicenseState("NY")
authNet.Transaction.DriversLicenseDOB("5/5/1972");
if (authNet.Authorize())
{
// Money in your pocket!
SaveSuccess(authNet.Response);
}
else
{
SaveFailure(authNet.Response);
}
MinimumCreditCard class
Properties
- Amount - Total value to be charged or credited inclusive of tax.
- CardCode - Three- or four-digit number on the back of a credit card.
- CardNum - Contains the credit card number.
- ExpDate - Contains the date on which the credit card expires.
- Login - Pass the Login ID used to access the Merchant Interface.
- Password - NOT RECOMMENTED USE TranKey INSTEAD - Pass the password from the merchant interface.
- Response - The response object returned by the Authorize.NET Gateway
- TestRequest - Indicates whether the transaction should be processed as a test transaction.
- TranKey - Transaction key obtained from the Merchant Interface.
- Transaction - The full transaction object.
- Type - Indicates the type of transaction: TranType.AUTH_CAPTURE, TranType.AUTH_ONLY...
Methods
Authorize - Sends the transaction to the Authorize.NET Gateway
Above, you already have one example of using the MinimumCreditCard class, so let's skip to the Response class and see how you might use it. Notice that above, we are calling the SaveResults method. Let's go ahead and implement that.
private void SaveSuccess(Response response)
{
ShoppingCart cart = GetCurrentCart();
cart.TransactionId = response.TransactionId;
cart.ApprovalCode = response.ApprovalCode;
cart.Save();
}
Response class
New Properties
These are the new values that are generated and/or returned by the Authorize.NET gateway.
- ResponseCode - Indicates the result of the transaction.
- ResponseSubCode - A code used by the system for internal transaction tracking.
- ReasonCode - A code representing more details about the result of the transaction.
- ReasonText - Brief description of the result, which corresponds with the Response Reason Code.
- ApprovalCode - The six-digit alphanumeric authorization or approval code.
- AvsResultCode - Indicates the result of Address Verification System (AVS) checks.
- TransactionId - This number identifies the transaction in the system and can be used to submit a modification of this transaction at a later time, such as voiding, crediting or capturing the transaction
- MD5Hash - System-generated hash that may be validated by the merchant to authenticate a transaction response received from the gateway.
- CreditCardResponseCode - Indicates the results of Card Code verification.
- CardHolderAuthResponse - Indicates the Card Holders Authorization response.
- SplitTenderID - The value that links the current authorization request to the original authorization request. This value is returned in the reply message from the original authorization request.
- RequestedAmount - Amount requested in the original authorization.
- BalanceOnCard - Balance on the debit card or prepaid card.
- AccountNumber - Indicates the account number.
- CardType - Visa, MasterCard, American Express, Discover, Diners Club, EnRoute, JCB.
- RawResponse - The raw response string sent back from Authorize.NET. Useful for debugging purposes.
The different response cores are useful. It is generally recommended that you show the ReasonText to the user in case of failure. It should give them a reasonable idea of what might have gone wrong.
There is a new requirement that if you accept debit or prepaid cards, you must display the amount remaining on the card on the reciept. The BalanceOnCard property allows you to do that. Echoed Properties
These are the values that were passed to the Authorize.NET gateway, in case you didn't keep around that ones that you need.
- InvoiceNumber - Echoed from form input value for x_Invoice_Num.
- Description - Echoed from form input value for x_Description.
- Amount - Echoed from form input value for x_Amount.
- Method - Echoed from form input value for x_Method.
- TransactionType - Echoed from form input value for x_Type.
- CustomerId - Echoed from form input value for x_Cust_ID.
- CardHolderFirstName- Echoed from form input value for x_First_Name.
- CardHolderLastName- Echoed from form input value for x_Last_Name.
- Company - Echoed from form input value for x_Company.
- BillingAddress- Echoed from form input value for x_Address.
- City - Echoed from form input value for x_City.
- State - Echoed from form input value for x_State.
- Zip - Echoed from form input value for x_Zip.
- Country - Echoed from form input value for x_Country.
- Phone - Echoed from form input value for x_Phone.
- Fax - Echoed from form input value for x_Fax.
- Email - Echoed from form input value for x_Email.
- ShipToFirstName- Echoed from form input value for x_Ship_To_First_Name.
- ShipToLastName- Echoed from form input value for x_Ship_To_Last_Name.
- ShipToCompany- Echoed from form input value for x_Ship_To_Company.
- ShipToAddress- Echoed from form input value for x_Ship_To_Address.
- ShipToCity - Echoed from form input value for x_Ship_To_City.
- ShipToState - Echoed from form input value for x_Ship_To_State.
- ShipToZip - Echoed from form input value for x_Ship_To_Zip.
- ShipToCountry- Echoed from form input value for x_Ship_To_Country.
- TaxAmount - Echoed from form input value for x_Tax.
- DutyAmount - Echoed from form input value for x_Duty.
- FreightAmount- Echoed from form input value for x_Freight.
- TaxExemptFlag- Echoed from form input value for x_Tax_Exempt.
- PONumber - Echoed from form input value for x_PO_Num.
If you have any questions or doubts then feel free to contact us. We will do our best to help you out.
Email: support@sharpauthorize.com
Skype: reflectionsoft
Googletalk: reflectionsoft


