Client-side API

After the script `collector-checkout-loader.js` has been loaded it will be possible to interact with the iframe using the provided API. The API functions are exposed via the global object `window.collector.checkout.api`.

Javascript examples

// Suspend the Checkout, showing a spinner...
window.collector.checkout.api.suspend();
// ... then do something...
// ... and finally resume the Checkout.
window.collector.checkout.api.resume();

API Reference

FunctionParameters     Description
init(none)This re-executes the initialization of the loading script. Not needed under normal circumstances.
suspendpublicToken (optional string)Sets the Checkout iframe in suspend mode. This results in all inputs and buttons being disabled and a spinner to be shown. If publicToken is not specified all Checkout iframes on the page will be suspended.
resumepublicToken (optional string)Resumes the Checkout to its normal state after a suspend. This results in data being loaded from the Checkout backend in order to stay up to date with any changes. If publicToken is not specified all Checkout iframes on the page will be resumed.