首页 > 解决方案 > Authorize.Net Accept Hosted Form constantly failing to display correctly

问题描述

Background:

I'm currently developing a .NET MVC application and attempting to integrate the Authorize.Net payment gateway with it. I've downloaded the Authorize.net SDK through Nuget to use within my app.

Primary order information is collected within my app and then the user is redirected to the Authorize.Net Accept Hosted form. (My client doesn't want any credit card entry on/from their site so that eliminates the Iframe/.js solutions from AuthNet)

Issue:

I've worked through all of the initial issues with the AuthNet integration and I'm now dealing with the absolute frustration of having to figure out why the hosted form shows correctly on occasion (VERY RARE), shows only an "Order Summary" header on other occasions, shows "Missing or invalid token" on yet other occasions and most of the time just plain doesn't appear at all.

I can post the code but it's not the code. I'm using the same records to test with - to ensure consistency on my end - and they have all, at one point or another, been successfully sent to the AuthNet form and processed correctly...but this is few and far between at this point.

I'm using the Authorize.Net provided SDK and I've already figured out the idiosyncrasies with it which is why the form appears sometimes. It can't be what I'm sending up otherwise it wouldn't work ALL the time rather than just some of the time.....

Things I've Tried to Resolve the Problem

  1. Set the Authorize.Net account to "Live" Mode
  2. Downgraded to SDK version 1.9.6 instead of 2.0.1 because, apparently, the older version was better than the new one.
  3. Ensured that all of my HostedPayment* options are correctly set and the values are appropriately formatted.
  4. Checked the Authorize.Net developer forums
  5. Checked on StackOverflow
  6. Searched the web
  7. Pulled all my hair out

Question:

Has anyone else run into problems getting the Accept Hosted Form to display consistently? If so, then how did you resolve the issue to make the form render correctly on a consistent basis? I mean REALLY consistently, not once every 30-40 tries.

Missing or invalid token

Accept Hosted Form at it's finest!

Seriously! It's incredibly frustrating!

标签: authorize.net

解决方案


好的 - 我浏览了我的代码并意识到这不是我的代码,而是我传递给 AuthNet 表单的 refId。Authnet 允许您将 refId 作为 20 个字符的字符串传递。我的应用为此使用了 GUID,但 GUID 太长,无法适应 AuthNet 的有限空间,因此我使用 Ascii85 对其进行了压缩。这种“压缩”将字母数字值更改为字母、数字和特殊字符的组合。

我感觉可能是这种情况,但有时即使提交的 refId 包含特殊字符,表单也能正确显示。我决定转向不同的跟踪策略,并且该表单现在始终如一地出现。毕竟是 refId。


推荐阅读