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?
โ03-15-2019 07:54 PM
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...
โ03-15-2019 08:09 PM
This is crazy. I commented out the New Order information. Who supports this code?
The bug was identified a year and a half ago!
โ08-10-2020 09:34 AM
i have same issue kindly suggest a solution please.
โ10-25-2020 10:38 PM
please help me out
โ10-26-2020 12:14 AM
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"
โ11-02-2023 12:10 AM