It’s now time to render the checkout snippet.
From the create order call response, get the html_snippet
property and embed it into your page where you would like the KCO to be rendered at.
There are two recommended ways of embedding the HTML snippet, server side or client side.
Embed the HTML snippet in your page served by your backend.
Get the HTML snippet via an Ajax call from your server and inject it dynamically, using Javascript, into your page. In this case, we should be sure that the script tag(s) are parsed and evaluated, which means, inserting the HTML snippet using innerHTML is not going to work.
Make sure to keep the script tags within the snippet as you receive them.
The snippet will render the checkout iframe.
Make sure to inject the snippet as-is in your main page/frame instead of inside an iframe, object or similar HTML tag since this would causes UI/UX and functionalities issues.