Skip to main content

Client-side API

After the script walley-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.walley.checkout.api.

Suspend and resume flow​

If you call any Checkout Backend API's while the checkout is visible, you must call suspend before you make the backend call, and after retrieving the answer, call resume to enable the checkout again.

// Suspend the Checkout, showing a spinner...
window.walley.checkout.api.suspend();

// ... then do a back end call and wait for the answer...

// ... and finally resume the Checkout.
window.walley.checkout.api.resume();

API Reference​

FunctionParameters     Description
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.