cancel
Showing results for 
Search instead for 
Did you mean: 

Accept Hosted (Redirect) with C# / ASP.net - "Unexpected error. Please try again." on payment form

Hi All, 

 

I've been banging my head agaist this for far too long now. 

 

I'm trying to build an ASP.net (C#) project using the "Hosted" suite to capture payment.

 

I started with the sample code on developer.authorize.net. No matter what I do (unless I try a change that manages to break "everything"), I get the payment form, but as soon as I click the  on the "Pay" button it turns to "processing" for a fraction of a second, then reverts to "Pay" and  I get: 

 

"Unexpected error. Please try again." 

 

This is with "live" CC details, test CC details, all of the fields completed, some of the fields completed.

 

I tried reaching out to authorize.net support, their only advice was to watch wireshark -- but I'm not seeing anything that jumps out as being wrong on the client or server side, but ovbiously there's a lot of noise and without knowing more about the underlying error or what things should look like I'm really getting tired of bashing my head against my desk.  

lincolnjkc1
Member
5 REPLIES 5

Hello @lincolnjkc1,

 

There are a number of reasons why you could be getting this error message. One of which is a known issue with the .NET SDK. Are you able to post the JSON or XML that you are sending? An alternative is to not use the SDK and build you own application for posting the required data for the token request. We don't have any issues with the C# application that we built at : https://nexwebsites.com/authorizenet/

 

Powered by NexWebSites.com -
Certified Authorize.net developers
NexusSoftware
Trusted Contributor

Hello I am working in C # everything works for me except when I want to add 'invoiceNumber'

 

 var order = new orderType();
                    order.invoiceNumber = "INV-12345";
                    order.description = "Example Pay";

 

We can share experiences if you share your code.

 

Regards

Wow, thanks for that tidbit @llavillaccama10!

 

If I knock the "order = new orderType
{
invoiceNumber = "INV-123456",
description = "TEST INVOICE"
}"

 

out of the sample code that started as: 

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

 

out of the sample code it works as expected (or, at a minimum, I get the receipt screen, so I feel like I'm making progress -- and it seems like there's something about that order detail that is making things unhappy (missing param? param expecting a number but getting a string? more detailed error reporting would definately be helpful, but I'll play with that a bit and see if I can figure out what's making it angry. 

Hello,

Can you help me finding the sample code for asp.net/c#?

uniquesol9
Member

I followed these intstructions however it did no longer repair the problem for me. I additionally tried to delete the goetas/xsd2php folder and re-run replace and it did not pull within the wished documents. Click here to see more detail.

lisfir4
Member