sample-code-csharp icon indicating copy to clipboard operation
sample-code-csharp copied to clipboard

Hosted payment page error after filling out payment information

Open sstalder opened this issue 6 years ago • 14 comments

Steps to reproduce:

  • Run sample for GetAnAcceptPaymentPage
  • Redirect to payment page via the code below
<form action="https://test.authorize.net/payment/payment" method="post">
	<input type="text" name="token" value="token value here" />
	<hr />
	<button type="submit">Pay</button>
</form>
  • Fill out form with test credit card information
Credit Card #: 4111111111111111
Credit Card Exp: 11/21
Credit Card Code: 907

Upon clicking pay you get an error "Unexpected error. Please try again."

I have tried several different ways to generate the token as well as several different types of credit card numbers (all test numbers) and amounts, etc. I cannot get a working sample to go through.

I even tried to do this in a production environment and had the same result. Can someone please let me know what exactly this error is?

You can duplicate the error using the sample codes api login or with any generated one from the sandbox.

sstalder avatar Mar 05 '19 20:03 sstalder

Hi, Apologies for the inconvenience caused. There seems to be a bug in the way that DateTime values are handled in the C# SDK.

A fix has been sent and is pending release ( .NET SDK #257 ).

Your code for doing the payment does not have any issues. I believe the issue is from the GetAnAcceptPaymentPage sample, if you are also using the order information in the request.

A temporary workaround for this is to include a valid date for order.purchaseOrderDateUTC in the format "YYYY-mm-dd".

transactionRequest = new transactionRequestType {
        amount = "100.00",
        transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),
        order = new orderType {
            invoiceNumber = invoiceId,
            description = invoiceId,
            purchaseOrderDateUTC = new DateTime(2018, 03, 23, 11, 00, 00, DateTimeKind.Utc)
        }
}

gnongsie avatar Mar 06 '19 09:03 gnongsie

In the .NET SDK the purchaseOrderDateUTC is a DateTime type. How are you putting a string for that value?

Can this fix also be moved to the dotnet core sdk as well?

sstalder avatar Mar 06 '19 13:03 sstalder

Unfortunately the workaround proposed doesn't appear to work. The only way I can get it to go through is to not include the "order" object.

sstalder avatar Mar 07 '19 13:03 sstalder

Hi, Apologies for the inconvenience. I initially thought this would fix the issue.

In any case, I have escalated this to the relevant team and will update this thread with the progress.

gnongsie avatar Mar 13 '19 05:03 gnongsie

Hey Gabriel, has there been any update on this issue? Thanks!

sstalder avatar May 16 '19 13:05 sstalder

Yikes. Five months later and this is still not fixed. For anyone trying to resolve this issue, I was able to get the sample code working by reverting to 1.9.6.

esw0000000 avatar Aug 21 '19 14:08 esw0000000

Is there any plan to fix this issue? I have to return to use 1.9.6 to make it works.

SeriaWei avatar Mar 02 '20 07:03 SeriaWei

Almost a year later. Any fix for this?

ahawes-clarity avatar Apr 15 '20 09:04 ahawes-clarity

Still an issue as of now. Workarounds are either to leave the 'order' undefined, or to revert to dotnet SDK version 1.9.6. On reviewing the API documentation here, it seems like the orderType object has a lot of new fields in version 1.9.7 and later, that don't seem to be defined in the API as of today.

w7tcp avatar Mar 03 '21 03:03 w7tcp

FIVE YEARS LATER, and this bug still has not been fixed.

popisms avatar Apr 29 '24 15:04 popisms