Wasay Syed

Senior Programmer & Web Developer

Published

December 23, 2021

Author

U
Unknown

AuthorizeNet Accept Sample App - Uncaught TypeError t is undefined

Solution for AuthorizeNet Accept Hosted Form (accept-sample-app) example.For error:Uncaught TypeError: t is undefined https://jstest.authorize.net/v3/AcceptUI.jsAs a developer, it is very annoying whe...

Solution for AuthorizeNet Accept Hosted Form (accept-sample-app) example.

For error:

Uncaught TypeError: t is undefined https://jstest.authorize.net/v3/AcceptUI.js

As a developer, it is very annoying when documentation ignores a step that is crucial in testing of the sample code.

For AuthorizeNet "Accept Sample App" code it was as simple as a class name "AcceptUI", reading the minified javascript code in reverse was no fun. At the same time, every sample code should be a standalone example, if it inherits from previous code, then one should mention that this code is continuation of xyz. Why provide a bookmark directly to the sample code, when the code requires additional code that is mentioned three-four pages up?

Sample from page:

https://developer.authorize.net/api/reference/features/acceptjs.html#Using_the_Hosted_Payment_Information_Form

<form id="paymentForm" method="POST" class="AcceptUI"
    action="https://YourServer/PathToExistingPaymentProcessingScript">
    <input type="text" name="cardNumber" id="cardNumber" placeholder="cardNumber"/> <br><br>
    <input type="text" name="expMonth" id="expMonth" placeholder="expMonth"/> <br><br>
    <input type="text" name="expYear" id="expYear" placeholder="expYear"/> <br><br>
    <input type="text" name="cardCode" id="cardCode" placeholder="cardCode"/> <br><br>
    <input type="hidden" name="dataValue" id="dataValue" />
    <input type="hidden" name="dataDescriptor" id="dataDescriptor" />
    <button>Pay</button>
</form>


I am not sure if class="AcceptUI" is supposed to be applied to some other tag, but that's for some other time to review.