We are using c# AIM method for our website's payment integration to authorize.net. We have an issue with Purchase order number in authorize.net. PO number is not being displayed in any of the transaction's detailed page.
Following is the variable assignment , where both are strings
data.PoNum = SessionManager.CurrentOrder.PurchaseOrderNumber;
If we make an assignment like
data.PoNum = "12345" ; -- This is being shown in transaction detail page but when we are sending dynamic varaibles , those are not being shown.
We have checked by printing po number to a text file at our end and we can confirm that we are successfully sending PO number to authorize.net Server. Please suggest us a possible solution for this issue .
Solved! Go to Solution.
โ02-25-2013 09:46 AM
Please clear about your point " you need to log the request as it is calling authorize.net. " .
do you do something like
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(post_url); objRequest.Method = "POST"; objRequest.ContentLength = post_string.Length; objRequest.ContentType = "application/x-www-form-urlencoded"; // post data is sent as a stream StreamWriter myWriter = null; myWriter = new StreamWriter(objRequest.GetRequestStream()); myWriter.Write(post_string); myWriter.Close();
Where the post string is all the fields. Either the log the whole post_string or just get the ponumber from that string.
โ02-26-2013 09:46 AM
So this works
data.PoNum = "12345" ;
but this didn't
data.PoNum = SessionManager.CurrentOrder.PurchaseOrderNumber;
Since it is AIM, can you log the request to authorize.net just before it send?
โ02-25-2013 10:56 AM
Hi Ranor,
First of all , Thanks for responding to my issue.
Coming to your queustion, Yes , we are able to log the value of both data.PoNum and SessionManager.CurrentOrder.PurchaseOrderNumber just before we send to the authorize.net.
Here is the detailed code :
private AuthorizeNet.GatewayRequest GetGateWayRequestData(PaymentCreditCard paymentCreditCard) { CreditCardInfo paymentInfo = paymentCreditCard.PaymentInfo as CreditCardInfo; if (paymentInfo == null) { throw new BusinessException("InvalidPaymentInfoTypeExpectedTypeIsCreditCardInfo"); } AuthorizeNetRequest data = new AuthorizeNetRequest(); string address = paymentCreditCard.BillingAddress.AddressLine1 + " " + paymentCreditCard.BillingAddress.AddressLine2; data.City = paymentCreditCard.BillingAddress.City; data.FirstName = this.NameOnCardToFirstName(paymentInfo.NameOnCard); data.LastName = this.NameOnCardToLastName(paymentInfo.NameOnCard); data.State = paymentCreditCard.BillingAddress.State.StateCode; data.Address = address; data.Zip = paymentCreditCard.BillingAddress.Zip; data.CardNum = CommerceUtility.Decrypt(paymentInfo.CardNumber); data.CardCode = paymentInfo.CVV.ToString(); data.ExpDate = paymentInfo.ExpirationMonth.ToString() + paymentInfo.ExpirationYear.ToString(); try { data.Tax = SessionManager.CurrentOrder.TotalTax.ToString("C"); data.PoNum = SessionManager.CurrentOrder.PurchaseOrderNumber; data.TaxExempt = "Y"; string[] lines = { data.Tax, data.PoNum, data.TaxExempt, SessionManager.CurrentOrder.PurchaseOrderNumber }; System.IO.File.WriteAllLines(@"D:\Development\CMSFrontEndSite\bin\WriteLines.txt", lines); } catch (Exception ex) { string[] lines = { "error","exception" }; System.IO.File.WriteAllLines(@"D:\Development\CMSFrontEndSite\bin\WriteLines.txt", lines); } return data; }
โ02-25-2013 08:29 PM - edited โ02-25-2013 08:32 PM
that is to build the data, what about the request itself? Can you log just before it added the cardnum, cardcode, expdate on the request?
โ02-26-2013 04:24 AM
Hello Raynor ,
SessionManager.CurrentOrder.PurchaseOrderNumber object is live and is maintaining the value accross the full cycle . We confirm it by below example
E x: If we assign data.Tax = SessionManager.CurrentOrder.PurchaseOrderNumber; , PO number is being shown perfectly over there in tax field .
but if i assign the same as data.PoNumber = SessionManager.CurrentOrder.PurchaseOrderNumber; it is not showing
So , PO number is being sent properly to authorize.net
Let me make it clear on this issue.
We are using iapps E-Commerce management Tool for this site and here is the process
1. User Logs in site
2. Add items to cart
3. Proceed to checkout page --> Here shipping address will be provided
4. Payment page --> Here Credit card details and billing address will be provided . With those details , a credit card object will be created .
5. Shipping method will be selected and payment amount will be updated in the creditcard object created in step :4
6. On click on "Place Order" button , this Credit card object is being sent to the previous code attached.
โ02-26-2013 07:24 AM
but you said
data.PoNum = "12345";
works
โ02-26-2013 08:05 AM
Yes, even we made that trail as well
Both attempts are successful
โ02-26-2013 08:17 AM
That why I didn't see the problem in your
private AuthorizeNet.GatewayRequest GetGateWayRequestData(PaymentCreditCard paymentCreditCard)
because if you IN that method just replace
data.PoNum = SessionManager.CurrentOrder.PurchaseOrderNumber;
with
data.PoNum = "12345";
and it would work, that is something else because it mean authorize.net could get the value, which mean somehow it didn't get pass correctly. And that why you need to log the request as it is calling authorize.net.
โ02-26-2013 08:41 AM
Hi ,
Please clear about your point " you need to log the request as it is calling authorize.net. " .
do you mean to ask us to log each and every detail of data object before sending it to authorize.net...
Among all the points, if there is a possiblity , can we call you or can we go with a chat session with you.
i hope that will quickly solve the problem .
If it is ok with you, please provide us your phone number or chat Id (Skype , Gmail any one)
โ02-26-2013 09:30 AM
Please clear about your point " you need to log the request as it is calling authorize.net. " .
do you do something like
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(post_url); objRequest.Method = "POST"; objRequest.ContentLength = post_string.Length; objRequest.ContentType = "application/x-www-form-urlencoded"; // post data is sent as a stream StreamWriter myWriter = null; myWriter = new StreamWriter(objRequest.GetRequestStream()); myWriter.Write(post_string); myWriter.Close();
Where the post string is all the fields. Either the log the whole post_string or just get the ponumber from that string.
โ02-26-2013 09:46 AM