sample-code-csharp
sample-code-csharp copied to clipboard
Hosted payment page error after filling out payment information
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.
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)
}
}
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?
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.
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.
Hey Gabriel, has there been any update on this issue? Thanks!
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.
Is there any plan to fix this issue? I have to return to use 1.9.6 to make it works.
Almost a year later. Any fix for this?
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.
FIVE YEARS LATER, and this bug still has not been fixed.