Reply
Member
Posts: 4
Registered: ‎04-04-2014

Sandbox Accept Hosted Form Error

We are trying to get off the legacy hosted payment form, but every time I click pay I get the error below:

  

messageCode: "E00001"

messageText: "Unexpected error. Please try again."

 

The problem is coming when running transactions via the Accept Suite. I am able to use the API Live Console to get reporting data and also get a Accept Hosted Token, but I am unable to process transactions in the sandox at all!?

 

All Star
Posts: 684
Registered: ‎11-05-2018

Re: Sandbox Accept Hosted Form Error

My best guess is that your issue is with the post location you are using to call the hosted payment page. Are you using the endpoint in the api docs? The correct endpoint is something like https://test.authorize.net/payment/payment for the sandbox. Look in the API reference bc I’m going off of memory.
Member
Posts: 4
Registered: ‎04-04-2014

Re: Sandbox Accept Hosted Form Error

Nope it has to do with the latest version of the nuget package version. The sandbox accept hosted form will render fine if you pass orderType in the order property, but it will not process the payment due to an internal error. I will post example code in a bit.
Member
Posts: 4
Registered: ‎04-04-2014

Re: Sandbox Accept Hosted Form Error

I created a new MVC Application in Visual Studio using .NET Framework 4.5.2.   The code below works if I use nuget pakckage version 1.9.6 if I use 1.9.7 this same payment will fail until I remove the transactionRequest order property.

 

Global.asax.cs

public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
    }

 

HomeController.cs



public class HomeController : Controller { public ActionResult Index() { var invoiceId = "18448294934052571560"; var custacct = "000000000010"; var custom_data = string.Format("{0}-{1}", invoiceId, custacct); ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX; ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType { name = "<LoginID>>", Item = "<TransactionKey>", ItemElementName = ItemChoiceType.transactionKey }; var controller = new getHostedPaymentPageController(new getHostedPaymentPageRequest { hostedPaymentSettings = new settingType[] { new settingType { settingName = "hostedPaymentReturnOptions", settingValue = string.Format(@"{{""showReceipt"":false,""url"":""{0}""}}", "<Ngrok Address for me>/AuthNetTest/Home/Receipt") }, new settingType { settingName = "hostedPaymentButtonOptions", settingValue = "{\"text\":\"Pay\"}" }, new settingType { settingName = "hostedPaymentPaymentOptions", settingValue = string.Format(@"{{""cardCodeRequired"": false, ""showCreditCard"": {0}, ""showBankAccount"": {1}}}", "true", "false") }, new settingType { settingName = "hostedPaymentSecurityOptions", settingValue = "{\"captcha\": false}" }, new settingType { settingName = "hostedPaymentShippingAddressOptions", settingValue = "{\"show\": false, \"required\": false}" }, new settingType { settingName = "hostedPaymentBillingAddressOptions", settingValue = "{\"show\": true, \"required\": false}" }, new settingType { settingName = "hostedPaymentCustomerOptions", settingValue = "{\"showEmail\": true, \"requiredEmail\": false, \"addPaymentProfile\": false}" } }, transactionRequest = new transactionRequestType { amount = 10.00M, transactionType = transactionTypeEnum.authCaptureTransaction.ToString(), order = new orderType { invoiceNumber = invoiceId, description = invoiceId, }, userFields = new userField[] { new userField { name = nameof(custom_data), value = custom_data } } }, }); var hostedPaymentResult = controller.ExecuteWithApiResponse(); ViewBag.Token = hostedPaymentResult.token; return View(); } public ActionResult Receipt() { ViewBag.Message = "Payment Finished"; return View(); }

 Index.cshtml

@{
    ViewBag.Title = "Home Page";
}

<form method="post" action="https://test.authorize.net/payment/payment" id="formAuthorizeNetTestPage" name="formAuthorizeNetTestPage">
    <input type="hidden" name="token" value="@(ViewBag.Token)" />
    Continue to Authorize.Net to Payment Page
    <button id="btnContinue">Continue to next page</button>
</form>
Posts: 2,765
Topics: 57
Kudos: 245
Blog Posts: 67
Registered: ‎12-05-2011

Re: Sandbox Accept Hosted Form Error

Hello @grantgoodart81 

 

This looks similar to an earlier thread but I don't see a solution yet.  

 

I will escalate this to a support engineer, but I would also suggest raising an issue on GitHub.  Doing so will notify the team working on this SDK directly.

Richard

Member
Posts: 4
Registered: ‎04-04-2014

Re: Sandbox Accept Hosted Form Error

@RichardH logged this GitHub Issue

New Member
Posts: 1
Registered: ‎11-28-2019

Re: Sandbox Accept Hosted Form Error

Plz help,
Getting error in Sanbox mode, when trying to payment via AuthroziedNet_AccpetHosted

see the Screenshot i have linked

 

Thanks