Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected error when using hosted payment page orderType #11

Open
mwrightmcci opened this issue Dec 21, 2018 · 6 comments
Open

Unexpected error when using hosted payment page orderType #11

mwrightmcci opened this issue Dec 21, 2018 · 6 comments

Comments

@mwrightmcci
Copy link

When I use the Hosted Payment Page API integration and attempt to make a payment the form gives an error: "Unexpected error. Please try again".

Steps to reproduce:

  1. Use the sdk library to create a getHostedPaymentPageRequest object and populate the transactionRequestType.order field (The error does not occur if this field is not populated):
var request = new getHostedPaymentPageRequest
{
	transactionRequest = new transactionRequestType
	{
		transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),
		amount = paymentAmount,
		order = new orderType
		{
			invoiceNumber = invoiceNumber,
			description = description
		}
	},
	hostedPaymentSettings = new settingType[]
	{
		new settingType
		{
			settingName = settingNameEnum.hostedPaymentPaymentOptions.ToString(),
			settingValue = "{\"cardCodeRequired\": true, \"showCreditCard\": true, \"showBankAccount\": false}"
		},
		new settingType
		{
			settingName = settingNameEnum.hostedPaymentReturnOptions.ToString(),
			settingValue = "{\"showReceipt\": false, \"url\": \"" + continueReturnURL + "\", \"urlText\": \"Continue\", \"cancelUrl\": \"" + cancelReturnURL + "\", \"cancelUrlText\": \"Cancel\"}"
		},
		new settingType
		{
			settingName = settingNameEnum.hostedPaymentIFrameCommunicatorUrl.ToString(),
			settingValue = "{\"url\": \"" + communicatorURL + "\"}"
		},
		new settingType
		{
			settingName = settingNameEnum.hostedPaymentBillingAddressOptions.ToString(),
			settingValue = "{\"show\": true, \"required\": false}"
		}
	} 
};
  1. Send the request and retrieve the token from the response.
  2. Use the token to load the hosted payment form into an iframe.
  3. Enter credit card information into the form and click the submit button.

Observed result:
The form will show an error message in red text, "Unexpected error. Please try again".

The response from Authorize.Net is:

{"resultCode":"Error","messageCode":"E00001","messageText":"Unexpected error. Please try again.","token":null,"transactionData":null,"userFields":null,"createPaymentProfileResponse":null}

Notes:
I had previously been using the dotnet sdk and did not experience this problem in version 1.9.6 or 1.9.7 (https://github.com/AuthorizeNet/sdk-dotnet). I did not change any code but switched to the dotnet core sdk DLL (https://github.com/AuthorizeNet/dotnet-core-sdk-beta/blob/master/ReleaseArtifact/AuthorizeNET.dll) and started seeing the problem.

If you inspect the requests being sent by the dotnet core sdk you'll see it has extra fields as part of the order information. It was sending discountAmount and purchaseOrderDateUTC with default values in addition to the invoiceNumber and description fields. I can only assume this causes a problem in Authorize.Net’s system because those fields are not part of the API (https://developer.authorize.net/api/reference/#accept-suite-get-an-accept-payment-page).

The decompiled orderType class definition in the dotnet core sdk has many fields that do not exist in the dotnet sdk. And the new discountAmount and purchaseOrderDateUTC fields are not nullable so they get sent along with default values. I downloaded the dotnet core sdk code from github, removed the extra fields in the orderType class and rebuilt the code. When I used that DLL I was able to complete a payment without any problems.

This is a blocking problem preventing us from using the dotnet core sdk. Can we get an idea of when this will be resolved? Also the sdk is still in beta, but the code repository has modifications in it from 2 years ago. Is there a reason it is still in beta, and when can we expect it will be available for use in production?

@nagasivaram-tadepalli
Copy link

Hey, how did you solve it?

@mwrightmcci
Copy link
Author

I modified the AuthorizeNet code to remove the fields causing the problem. Take a look here: mccinnovations@047463a

@nagasivaram-tadepalli
Copy link

nagasivaram-tadepalli commented Jun 3, 2020

Can you please provide me with a sample? something with createcustormerprofile
I am facing errors with the Environment field and couldnt able to set it.

AuthorizeNet.Api.Controllers.Bases.ApiOperationBase`2' threw an exception.
Inner exception : Method not found

@mariolevesque
Copy link

This problem still exist. (01 Mar 2022)
I have a .NET core 3.1 solution.
I corrected the issue by un-installing the AuthorizeNet version 2.0.2 NuGet package
and installing the NuGet AuthorizeNet.Fork.Aspcore2 package version 1.9.3 instead.

Here is what my orderType object looks like and the transactionRequestType that uses it:

        var orderInfo = new orderType
        {
            invoiceNumber = "something-1234567890",    //String, up to 20 characters.
            description = "my order description"   //String, up to 255 characters.
        };

...

        var transactionRequest = new transactionRequestType
        {
            transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),    // authorize capture only
            amount = amount,  
            order = orderInfo,  
            billTo = billingAddress,
            lineItems = lineItems
        };

@bfarrington42
Copy link

This appears to still be broken months later in version 2.0.3. Switching to AuthorizeNet.Fork.Aspcore2 v1.9.3 fixes the problem, as previously mentioned, but is there a plan to resolve this issue with the official package?

@richardybias
Copy link

richardybias commented Nov 2, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants