cancel
Showing results for 
Search instead for 
Did you mean: 

Accept Hosted - transactionRequestType.Order causes Unexpected Error

ASP.Net

 

I have tried exacly what is in the sample code:

https://developer.authorize.net/api/reference/features/accept_hosted.html

 

...by going to this link for the  sample code

https://developer.authorize.net/api/reference/#accept-suite-get-an-accept-payment-page

 

SAMPLE CODE:

var transactionRequest = new transactionRequestType
{
transactionType = transactionTypeEnum.authCaptureTransaction.ToString(), // authorize capture only
amount = amount,
order = new orderType
{
invoiceNumber = "INV-123456",
description = "TEST INVOICE"
}
};

 

Almost everything runs fine, right up to pressing the "Pay" button, then I get:

"Unexpected error. Please try again."

 

When I comment out the "order = new orderType..." section of the code, EVERYTHING then runs perfectly - the tranaction goes through, the receipt is displayed, email with receipt is received...

 

However, I do *NOT* get the invoiceNumber in the order - because I didn't set the values to avoid this weird "Unexpected error...".

 

I've ONLY tried this in the Sandbox.

 

I've also stepped through the code, and the values ARE proerly set before the nonce Token is created.

 

It's been many hours hunting for an answer - I can't believe I'm the first person to copy the sample code and have it blow up...

 

Thoughts?

jdr
Member
5 REPLIES 5

SOLVED - temporarily...

 

Rolled back the ASP.NET Authroize.Net SDK from version 2.0.0 to version 1.9.6

 

I found this posting saying 1.9.7 and 2.0.0 both have issues:
https://community.developer.authorize.net/t5/Integration-and-Testing/OrderType-is-causing-Unexpected...

 

 

jdr
Member

This is crazy.  I commented out the New Order information.  Who supports this code?

The bug was identified a year and a half ago!

i have same issue kindly suggest a solution please.

Ashar
Member

please help me out 

Ashar
Member

We already found the solution.

In the orderType Class, there was a purchaseOrderDateUTC property which was set as required.

Delete purchaseOrderDateUTC property under "Utility/AnetApiSchema.generated.cs"

rybias87
Member