globalpayments / rxp-js

Global Payments Ecommerce JavaScript Library
MIT License
34 stars 70 forks source link

core.js:7187 ERROR SyntaxError: Unexpected token E in JSON at position 0 at JSON.parse (<anonymous>) at rxp-hpp.js:300 #29

Open viqashussain opened 5 years ago

viqashussain commented 5 years ago

I'm testing my payment form and when I try to test a card that returns a 200 auth code, I receive the following error:

core.js:7187 ERROR SyntaxError: Unexpected token E in JSON at position 0 at JSON.parse () at rxp-hpp.js:300

It's because the message received from GlobalPayments is not in the correct format.

liao02x commented 4 years ago

Came across the same issue. Here is my test case:

  1. Put something in the far future like 11/44 for the expiry date for the credit card.
  2. Using 4242 4242 4242 4242 for test cards.

The server returns "Error: 509
Message: Expiry date invalid" as a string instead of a valid JSON, so the error happens when doing JSON.parse(event.data).

I'll have to do some modifications to the library as a hack, but the maintainer should fix it ASAP.

tonygayter commented 4 years ago

Did anyone find a solution to this? Im hitting this problem

jsblanco commented 3 years ago

Is this ever going to be addressed? I'm having the same issue

sbparsons commented 3 years ago

As am I - not a fan of modifying third party JS files as it means future updates are risky... but that's where we are I guess.

sarimarri commented 3 years ago

I had exactly same issue then at line 300 please include the following code

try {
                var test = event.data;

                console.log("test"+event.data);  //Here the log can print the issue and you can handle it.
                }

catch (err) { console.log(err); return; }