Reply
Member
Posts: 2
Registered: ‎03-18-2021

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.  

Posts: 492
Topics: 0
Kudos: 99
Blog Posts: 0
Ideas: 0
Solutions: 42
Registered: ‎04-28-2017

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

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
Member
Posts: 3
Registered: ‎03-18-2021

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

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

Member
Posts: 2
Registered: ‎03-18-2021

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

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. 

Member
Posts: 2
Registered: ‎07-09-2021

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

Hello,

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