When you configure the Authorize.Net Accept Hosted form, you might get the “Unexpected token ! in JSON at position 0” error b/c of malformed URL in the hostedPaymentReturnOptions parameter. To fix that I had to:
- Stop using “localhost” in the URLs. Apparently Authorize.Net doesn’t like that and throws an error.
- Escape ampersands with encodeURIComponent().
url.replace(/&/g, encodeURIComponent('&')