Adyen Web SDK initialization issue. Confusing error

I get the following error when I try to initialize the web SDK.

VM160 checkoutSDK.1.9.5.min.js:15 
Uncaught Error: The JSON passed to chckt.checkout was not properly formatted as JSON (typeof data: boolean, loading failure)
    at VM160 checkoutSDK.1.9.5.min.js:15
    at Tc (VM160 checkoutSDK.1.9.5.min.js:15)
    at jc (VM160 checkoutSDK.1.9.5.min.js:15)
    at Object.init [as checkout] (VM160 checkoutSDK.1.9.5.min.js:15)
    at index.html:23

I'm following the documentation from here https://docs.adyen.com/checkout/web-sdk My issue is when I run

var checkout = chckt.checkout(paymentSession, '#payment-container', sdkConfigObj);

My paymentSession is a really long string that I get with Postman. My node exists and has the id mentioned. And the sdkConfigObj is

var sdkConfigObj = {
   context : 'test'
}; 

I tried sending paymentSession as a number or object and I get an error that says paymentSession invalid. I tried sending a node instead as the second argument and I receive an error that says its invalid format, sent a string that doesnt exists and says the node doesn't exits. I made it fail multiple times using wrong inputs but with the correct input (at least in my opinion) can't figure out why it fails.

Upvotes: 0

Views: 576

Answers (1)

Keren
Keren

Reputation: 11

I had the same issue. what worked for me, for paymentSession, was passing only the token itself as a string. (not a node, not an object, not stringified etc)

the sdk I'm using - "https://checkoutshopper-test.adyen.com/checkoutshopper/assets/js/sdk/checkoutSDK.1.9.7.min.js"

var sdkConfigObj = {
  context : 'test' // change this to 'live' when you go live.
};

var checkout = chckt.checkout("ehcbxlgjrglj...", "#checkout", sdkConfigObj);

Hope it helped

Upvotes: 1

Related Questions