I'm using the AIM AuthorizeNet library for .NET to process AUTH_CAPTURE transactions.
The transaction goes thru OK and it appears to get some of the data I pass it - like the fact that it's an AUTH_CAPTURE and the amount, but it doesn't have any of the Customer Billing Information (Invoice, Description, Address, Phone, Email) or Additional Information (Freight, Tax) that I pass it.
Am I not doing this correctly?
Here's my code:
Dim authReq As AuthorizeNet.AuthorizationRequest
Dim post_values As New System.Collections.Specialized.NameValueCollection
post_values.Add("x_login", "xxxxx")
post_values.Add("x_tran_key", "xxxxxxxxxx")
post_values.Add("x_version", "3.1")
post_values.Add("x_delim_data", "TRUE")
post_values.Add("x_delim_char", "|")
post_values.Add("x_relay_response", "FALSE")
post_values.Add("x_type", "AUTH_CAPTURE")
post_values.Add("x_method", "CC")
post_values.Add("x_card_num", txtCreditCard.Text.Replace(" ", "").Replace("-", ""))
post_values.Add("x_card_code", txtCCV.Text)
post_values.Add("x_exp_date", txtExpDate.Text)
post_values.Add("x_amount", order.OrderTotal.ToString("0.00"))
post_values.Add("x_tax", order.SalesTax.ToString("0.00"))
post_values.Add("x_freight", order.ShippingAmount.ToString("0.00"))
post_values.Add("x_description", "Order " + order.OrderId.ToString + " for Project " + order.ProjectName)
post_values.Add("x_invoice_num", "P-" + order.ProjectId.ToString + "O-" + order.OrderId.ToString)
post_values.Add("x_address", txtBillAddr1.Text)
post_values.Add("x_city", txtBillCity.Text)
post_values.Add("x_state", txtBillState.Text)
post_values.Add("x_zip", txtBillZip.Text)
post_values.Add("x_phone", txtPhoneNumber.Text)
post_values.Add("x_cust_id", systemUser.UserId.ToString)
post_values.Add("x_email", systemUser.Email)
post_values.Add("x_customer_ip", request.UserHostAddress)
authReq = New AuthorizeNet.AuthorizationRequest(post_values)
Dim gate As New AuthorizeNet.Gateway("4kL4H8gRy", "225JNwmN52sw566f", True)
Dim resp As AuthorizeNet.IGatewayResponse = gate.Send(authReq)
I get a successful response back including TransId and AuthCode, but the email I get back (see below) doesn't have any of the extended information in it.
Here's an example of an email receipt I get back...
========= ORDER INFORMATION =========
Invoice :
Description :
Amount : 132.00 (USD)
Payment Method : Visa
Type : Authorization and Capture
============== RESULTS ==============
Response : This transaction has been approved.
Authorization Code : xxxxx
Transaction ID : xxxxxxxxx
Address Verification : Street Address: Match -- First 5 Digits of Zip: Match
==== CUSTOMER BILLING INFORMATION ===
Customer ID :
First Name :
Last Name :
Company :
Address :
City :
State/Province :
Zip/Postal Code :
Country :
Phone :
Fax :
E-Mail :
==== CUSTOMER SHIPPING INFORMATION ===
First Name :
Last Name :
Company :
Address :
City :
State/Province :
Zip/Postal Code :
Country :
======= ADDITIONAL INFORMATION ======
Tax :
Duty :
Freight :
Tax Exempt :
PO Number :
Thanks for the help,
Mike
Solved! Go to Solution.
โ01-06-2011 07:58 AM
โ01-13-2011 05:28 PM
Look like the .net SDK only passing CC#, CC Exp and Amount for AIM AUTH_CAPTURE.
โ01-06-2011 04:06 PM
So is that a bug in the .NET SDK? Is there something I should do differently?
Thanks,
Mike
โ01-13-2011 04:19 PM
after
authReq = New AuthorizeNet.AuthorizationRequest(post_values)
you can add the other fields
authReq.AddMerchantValue("key","value");
e.g.
authReq.AddMerchantValue(("x_tax", order.SalesTax.ToString("0.00"));
โ01-13-2011 05:09 PM
Thank you Clement - worked like a charm!
Cheers,
Mike
โ01-13-2011 05:28 PM
Hi,
I am having almost same problem i-e. no CUSTOMER SHIPPING INFORMATION and no ADDITIONAL INFORMATION. Following is the result email i am getting.
Response : This transaction has been approved.
Authorization Code : 375767
Transaction ID : 5128485806
Address Verification : Street Address: Match -- First 5 Digits of Zip: Match
==== CUSTOMER BILLING INFORMATION ===
Customer ID :
First Name : abc
Last Name : def
Company :
Address : 74 sadlajkl
City : Langhorne
State/Province : PA
Zip/Postal Code : 19047
Country : US
Phone :
Fax :
E-Mail :
==== CUSTOMER SHIPPING INFORMATION ===
First Name :
Last Name :
Company :
Address :
City :
State/Province :
Zip/Postal Code :
Country :
======= ADDITIONAL INFORMATION ======
Tax :
Duty :
Freight :
Tax Exempt :
PO Number :
When i checked the code I was not actually putting these things in NameValueCollection object. its actually using public void ProcessPayment(PaymentInfo paymentInfo, Customer customer, Guid orderGuid, ref ProcessPaymentResult processPaymentResult) method and I dont get any orderInfo object in this method to add additional information. below is my code with fields added so far.
NameValueCollection form = new NameValueCollection();
form.Add("x_login", loginID);
form.Add("x_tran_key", transactionKey);
if (useSandBox)
form.Add("x_test_request", "TRUE");
else
form.Add("x_test_request", "FALSE");
form.Add("x_delim_data", "TRUE");
form.Add("x_delim_char", "|");
form.Add("x_encap_char", "");
form.Add("x_version", APIVersion);
form.Add("x_relay_response", "FALSE");
form.Add("x_method", "CC");
form.Add("x_currency_code", CurrencyManager.PrimaryStoreCurrency.CurrencyCode);
if (transactionMode == TransactMode.Authorize)
form.Add("x_type", "AUTH_ONLY");
else if (transactionMode == TransactMode.AuthorizeAndCapture)
form.Add("x_type", "AUTH_CAPTURE");
else
throw new NopException("Not supported transaction mode");
form.Add("x_amount", paymentInfo.OrderTotal.ToString("0.00", CultureInfo.InvariantCulture));
form.Add("x_card_num", paymentInfo.CreditCardNumber);
form.Add("x_exp_date", paymentInfo.CreditCardExpireMonth.ToString("D2") + paymentInfo.CreditCardExpireYear.ToString());
form.Add("x_card_code", paymentInfo.CreditCardCvv2);
form.Add("x_first_name", paymentInfo.BillingAddress.FirstName);
form.Add("x_last_name", paymentInfo.BillingAddress.LastName);
if (string.IsNullOrEmpty(paymentInfo.BillingAddress.Company))
form.Add("x_company", paymentInfo.BillingAddress.Company);
form.Add("x_address", paymentInfo.BillingAddress.Address1);
form.Add("x_city", paymentInfo.BillingAddress.City);
if (paymentInfo.BillingAddress.StateProvince != null)
form.Add("x_state", paymentInfo.BillingAddress.StateProvince.Abbreviation);
form.Add("x_zip", paymentInfo.BillingAddress.ZipPostalCode);
if (paymentInfo.BillingAddress.Country != null)
form.Add("x_country", paymentInfo.BillingAddress.Country.TwoLetterIsoCode);
form.Add("x_invoice_num", orderGuid.ToString());
form.Add("x_customer_ip", HttpContext.Current.Request.UserHostAddress);
//x_ship_to_state
form.Add("x_ship_to_first_name", customer.ShippingAddress.FirstName);
form.Add("x_ship_to_last_name", customer.ShippingAddress.LastName);
form.Add("x_ship_to_company", customer.ShippingAddress.Company);
form.Add("x_ship_to_address", customer.ShippingAddress.Address1 + customer.ShippingAddress.Address1);
form.Add("x_ship_to_city", customer.ShippingAddress.City);
form.Add("x_ship_to_state", customer.ShippingAddress.StateProvince.Name);
form.Add("x_ship_to_zip", customer.ShippingAddress.ZipPostalCode);
form.Add("x_ship_to_country", customer.ShippingAddress.Country.Name);
however I am still unable to figure out where should I add the fields below.
form.Add("x_invoice_num", "P-" + paymentInfo.ProjectId.ToString + "O-" + paymentInfo.o.ToString);
form.Add("x_amount", orderInfo.GrandTotal.ToString("0.00", ci_enUS));
form.Add("x_tax", orderInfo.Tax.ToString("0.00", ci_enUS));
form.Add("x_freight", customer.ShippingAddress ("0.00", ci_enUS));
can you please help me out in this regard.
โ04-19-2013 02:03 PM
did you try the 01-13-2011 07:09 PM post solution?
โ04-19-2013 03:06 PM
Hi Mike
I am also working AIM Functionality.......
But facing few error.........
If you dont mind,.....can You share me a sample application , so that I can check out properly for all fields.
โ04-23-2013 10:55 AM
hi Raynor...
Sorry I was a bit busy in some other tasks was unable to reply back, Acutally I was looking at the solution you suggested but I was unable to find the authReq = New AuthorizeNet.AuthorizationRequest(post_values) in my code.
And authReq.AddMerchantValue(("x_tax", order.SalesTax.ToString("0.00")); is also using order object which I dont have in ProcessPayment method. Below is function signature for processPayment that is calling.
public void ProcessPayment(PaymentInfo paymentInfo, Customer customer, Guid orderGuid, ref ProcessPaymentResult processPaymentResult);
Your help will be highly appreciated. Thanks
Samee Javaid
โ04-29-2013 09:52 AM
public void ProcessPayment(PaymentInfo paymentInfo, Customer customer, Guid orderGuid, ref ProcessPaymentResult processPaymentResult);
That look like your custom code. Can't you run debug and see what wrong with it?
โ04-29-2013 10:56 AM