Start a new topic

Issue with hosted pages integration

Hello,


I have an error when integrating iframe.


I followed this tutorial: 

https://www.chargebee.com/tutorials/embedded-hosted-pages-example.html#embedding-hosted-page


The first step, "Request a hosted page URL", is working fine.


This is the response I get:

{
  url: "https://video-test.chargebee.com/pages/v3/ZVJJPFvjlShhNg51GtvXx4DzzHJ8axQO/", 
  hosted_page_id: "ZVJJPFvjlShhNg51GtvXx4DzzHJ8axQO", 
  site_name: "video-test"
}

  Then, when implementing subscribeResponseEmbedHandler, an error occurs after the addIframe callback.


The following error is displayed in Chrome console:

 

VM4217:1 Uncaught SyntaxError: Unexpected token o in JSON at position 1
    at JSON.parse (<anonymous>)
    at messageChannel (chargebee.js:formatted:338)
    at attachedCallback (chargebee.js:formatted:295)

After a debug session, we noticed that this line tries to parse a JSON string object but it is already an object.

The value of message.data at this time is this object: 

{key:"cb.page_visited", type:"checkout",value:"cart_screen"}


Can you help me solve this issue?





1 Comment

Hi Thomas


The tutorial link you're referring to is for an earlier version of our checkout pages.


I see that you're using the new version, so kindly use this link for the configuration steps - https://jsdocs.chargebee.com/index.html#/


Apologies for the confusion.

Login or Signup to post a comment