ASPX templates
Version 5.x > ASPX templates > Authorize.NET Additional Values View modes: 
User avatar
Certified Developer 8
Certified Developer 8
bryan-bit-wizards - 4/5/2010 4:03:25 PM
   
Authorize.NET Additional Values
Is it possible to append additional information to an Autorize.NET post using Kentico's ecommerce module? I have appended several values before in standard .NET Authorize.NET calls (PO#, Invoice #, notes, etc).

Is it possible to attend similar information using Kentico's ecommerce module?

Thank you for your help.

-Bryan

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 4/6/2010 5:23:15 AM
   
RE:Authorize.NET Additional Values
Hello Bryan,


if you have full source code you may re-write the code of CMSAuthorizeNetProvider (<solution folder>/EcommerceProvider). If you have not got a full source code you would need to develop a custom payment gateway for Authorize.NET according to your needs. Please see the Custom payment gateway documentation.


Best regards,
Helena Grulichova

User avatar
Member
Member
stulip2007-rediffmail - 12/19/2011 8:22:08 AM
   
RE:Authorize.NET Additional Values
Hi,

Can you please explain how we can integrate authorize.net in kentico. Sample code for better understanding will be appreciable.

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 12/20/2011 2:13:20 AM
   
RE:Authorize.NET Additional Values
Hello,

Authorize.net is available in Kentico by default. For more information on how to set up this payment gateway, please check our documentation.

Best regards,
Boris Pocatko

User avatar
Member
Member
stulip2007-rediffmail - 12/20/2011 3:49:15 AM
   
RE:Authorize.NET Additional Values
How we can consume web service through kentico.

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 12/20/2011 5:49:24 AM
   
RE:Authorize.NET Additional Values
Hello,

You can create a custom module or web part which would consume your service. There are some web parts available, however, they are working only with Kentico specific services. For more information on creating a new module please check this link.

Best regards,
Boris Pocatko

User avatar
Certified Developer 8
Certified Developer 8
bryan-bit-wizards - 12/20/2011 9:41:31 AM
   
RE:Authorize.NET Additional Values
There are many ways to integrate with Authorize.NET. One of the simpler ways is to post to the Authoerize.NET site and get a response. Doing so requires populating the post with all of the fields Authorize.NET is expecting. Here is some sample code that does a post and gets back a response:

/// <summary>
/// This function will authorize the payment by posting directly to Authorize.NET
/// </summary>
public void AuthorizePayment()
{
string AuthNetVersion = "3.1"; // Contains CCV support
string AuthNetLoginID = ConfigurationManager.AppSettings["Authorize.NETLoginID"].ToString();
string AuthNetPassword = ConfigurationManager.AppSettings["Authorize.NETPassword"].ToString();
// Get this from your authorize.net merchant interface
string AuthNetTransKey = ConfigurationManager.AppSettings["Authorize.NETTransKey"].ToString();

Boolean blnTestTransaction = Convert.ToBoolean(ConfigurationManager.AppSettings["Authorize.NETTestTransaction"].ToString());

WebClient objRequest = new WebClient();
System.Collections.Specialized.NameValueCollection objInf =
new System.Collections.Specialized.NameValueCollection(30);
System.Collections.Specialized.NameValueCollection objRetInf =
new System.Collections.Specialized.NameValueCollection(30);
byte[] objRetBytes;
string[] objRetVals;
string strError;

objInf.Add("x_version", AuthNetVersion);
objInf.Add("x_delim_data", "True");
objInf.Add("x_login", AuthNetLoginID);
objInf.Add("x_password", AuthNetPassword);
objInf.Add("x_tran_key", AuthNetTransKey);
objInf.Add("x_relay_response", "False");

objInf.Add("x_test_request", blnTestTransaction.ToString());

objInf.Add("x_delim_char", ",");
objInf.Add("x_encap_char", "|");

// Billing Address
objInf.Add("x_first_name", this.CustomerFirstName);
objInf.Add("x_last_name", this.CustomerLastName);
objInf.Add("x_address", this.CustomerAddress);
objInf.Add("x_city", this.CustomerCity);
objInf.Add("x_state", this.CustomerState);
objInf.Add("x_zip", this.CustomerZIP);
objInf.Add("x_country", this.CustomerCountry);
objInf.Add("x_phone", this.CustomerPhone);

objInf.Add("x_description", this.Description);
objInf.Add("x_po_num", this.PONumber);

// Card Details
objInf.Add("x_card_num", this.CCNumber);
objInf.Add("x_exp_date", this.ExpirationDate);

// Authorisation code of the card (CCV)
objInf.Add("x_card_code", this.CVV2Number);

objInf.Add("x_method", "CC");
objInf.Add("x_type", "AUTH_CAPTURE");
objInf.Add("x_amount", this.Amount.ToString());

// Currency setting. Check the guide for other supported currencies
objInf.Add("x_currency_code", "USD");

try
{
// Pure Test Server
objRequest.BaseAddress =
"https://secure.authorize.net/gateway/transact.dll";

objRetBytes =
objRequest.UploadValues(objRequest.BaseAddress, "POST", objInf);
objRetVals =
System.Text.Encoding.ASCII.GetString(objRetBytes).Split(",".ToCharArray());

this.ResponseCode = objRetVals[0].Trim(char.Parse("|"));

if (objRetVals[0].Trim(char.Parse("|")) == "1")
{
// Returned Authorization Code
//this.ResponseCode = objRetVals[4].Trim(char.Parse("|")); ;
// Returned Transaction ID
this.TransactionID = objRetVals[6].Trim(char.Parse("|"));
this.ResponseMessage = "Approved";
}
else
{
// Error!
strError = objRetVals[3].Trim(char.Parse("|")) + " (" +
objRetVals[2].Trim(char.Parse("|")) + ")";

if (objRetVals[2].Trim(char.Parse("|")) == "44")
{
// CCV transaction decline
strError += "Our Card Code Verification (CCV) returned " +
"the following error: ";

switch (objRetVals[38].Trim(char.Parse("|")))
{
case "N":
strError += "Card Code does not match.";
break;
case "P":
strError += "Card Code was not processed.";
break;
case "S":
strError += "Card Code should be on card but was not indicated.";
break;
case "U":
strError += "Issuer was not certified for Card Code.";
break;
}
}

if (objRetVals[2].Trim(char.Parse("|")) == "45")
{
if (strError.Length > 1)
strError += "<br />n";

// AVS transaction decline
strError += "Our Address Verification System (AVS) " +
"returned the following error: ";

switch (objRetVals[5].Trim(char.Parse("|")))
{
case "A":
strError += " the zip code entered does not match " +
"the billing address.";
break;
case "B":
strError += " no information was provided for the AVS check.";
break;
case "E":
strError += " a general error occurred in the AVS system.";
break;
case "G":
strError += " the credit card was issued by a non-US bank.";
break;
case "N":
strError += " neither the entered street address nor zip " +
"code matches the billing address.";
break;
case "P":
strError += " AVS is not applicable for this transaction.";
break;
case "R":
strError += " please retry the transaction; the AVS system " +
"was unavailable or timed out.";
break;
case "S":
strError += " the AVS service is not supported by your " +
"credit card issuer.";
break;
case "U":
strError += " address information is unavailable for the " +
"credit card.";
break;
case "W":
strError += " the 9 digit zip code matches, but the " +
"street address does not.";
break;
case "Z":
strError += " the zip code matches, but the address does not.";
break;
}
}

// strError contains the actual error
this.ResponseMessage = strError;
}
}
catch (Exception ex)
{
this.ResponseMessage = ex.Message;
}
}

Best of luck!

-Bryan Soltis

User avatar
Member
Member
stulip2007-rediffmail - 12/20/2011 10:29:10 PM
   
RE:Authorize.NET Additional Values
Hi,

I have already implemented this method.In my aspx code behind ,but what I am exactly looking for is how to implement this authorize.net functionality using kentico i.e Is there any way to access loginId and transaction key set in kentico, to our code behind file.

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 1/3/2012 5:58:30 AM
   
RE:Authorize.NET Additional Values
Hello,

Regrettably, the parameters are encapsulated in the CMS.EcommerceProvider dll file. You will have to create a new payment provider to create the given parameters.

Best regards,
Boris Pocatko