---
id: clientapi
title: Client-side API
hide_title: true
description: "Client side or frontend api for Walley Checkout"
---

import Ingress from '../../../src/components/ingress/ingress.react';

<Ingress title="Client-side API">
    After the script <code>walley-checkout-loader.js</code> 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 <code>window.walley.checkout.api</code>.
</Ingress>

## 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.

```javascript
// 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

| Function    | Parameters&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Description                                                                                                                                                                                                                                             |
| ----------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **suspend** | `publicToken` (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.                                        |
| **resume**  | `publicToken` (optional string)          | Resumes the Checkout to its normal state after a suspend. This results in data being loaded from the Checkout backend to stay up to date with any changes. If `publicToken` is not specified all Checkout iframes on the page will be resumed. |
