> This page is for version v2 (default).
> For other versions, use one of these documentation indexes:
> - v2 (default): https://developers.clearpay.co.uk/v-2/llms.txt
> - v1: https://developers.clearpay.co.uk/v-1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.clearpay.co.uk/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.clearpay.co.uk/_mcp/server.

# JavaScript afterpay.js

## Production

**`All Regions`**

```text All Regions
https://portal.clearpay.co.uk/afterpay.js
```

## Sandbox

**`All Regions`**

```text All Regions
https://portal.sandbox.clearpay.co.uk/afterpay.js
```

The `afterpay.js` is used to launch the Clearpay screenflow, where the consumer logs in (or registers) then confirms their payment schedule.

> **Note**
>
> Before this JavaScript can be used, the merchant must call [Create Checkout](/api-reference/online-api/checkouts/create-checkout) from their server backend and retrieve a checkout token. The token is then used in conjunction with this JavaScript to launch the Clearpay screenflow.

> **Note**
>
> It is only after the consumer completes the Clearpay screenflow and returns to the merchant's website that a subsequent Auth or Capture (Without Auth) call can be completed.