> ## Documentation Index
> Fetch the complete documentation index at: https://docs.plandalf.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SDK API

Plandalf is designed to be as low touch as possible. It should be able to run in the background and not require any manual intervention. However, there are some cases where you might want to interact with Plandalf programmatically.

# Listen to events

```js theme={null}
plandalf.on('<EVENT_NAME>', () => {
    // callback is triggered when the checkout event happens
})
```

Events:

* `checkout-success` - Triggered when a successful checkout happens
* `checkout-error`   - Triggered when a checkout error occurs

# Fire a custom event

If you have configured your workflow listener to use `custom` triggers, you can fire a custom event using the following code:

```js theme={null}
plandalf.fireEvent('<CUSTOM_EVENT>')
```

# Check if a workflow is active

Useful for fallback

```js theme={null}
plandalf.isWorkflowActive('<WORKFLOW_IDENTIFIER>')
```
