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

# Store Clearpay as a Payment Method

> What are the API calls required to setup recurring payments with Clearpay?

The first step to enable Recurring Payments functionality is to setup consumer approval by calling the billing agreements approval API.

## 1. Setup Billing Agreement Approval

* [Setup Billing Agreement Approval](/draft-setup-billing-agreement-approval)

![](/_fern-img/93c60fbcb0a60c78fb77516c0233cb71b1f08b08d9dcd7754085fa24e8421c7f.webp)

You will call the Setup Billing Agreement Approval endpoint to give Clearpay information including:

* Customer Information
* The URL you want the customer to go to when they complete the Clearpay approval flow
* Agreement Information

Clearpay responds with a token used to identify this approval flow.\
e.g. `003.5lmerr3k945d00c7htvcrdff83q36kp10a247m212fjpa5ju`

The token is used with the [JavaScript library](https://dash.readme.com/project/clearpay-online/v2/docs/javascript-library) to direct the customer to the Clearpay approval flow.

![](/_fern-img/30f63f56e0ca16ccdefe7369ddf424b69882e6fec6f7cec6161bf9064c59a4da.webp)

After the customer completes the approval flow, they are returned to the merchant website URL. This is the URL provided in the Setup Billing Agreement request. If the merchant uses the [Redirect Method](https://developers.clearpay.co.uk/clearpay-online/reference/redirect-method) the URL will have the status appended to the Merchant URL. For Example:

* If the customer successfully completes the approval flow:\
  `www.merchant-example.com/confirm?&status=SUCCESS&orderToken=003.5lmerr3k945d00c7htvcrdff83q36kp10a247m212fjpa5ju`
* If the customer closes the window:\
  `www.merchant-example.com/confirm?&status=CANCELLED&orderToken=003.5lmerr3k945d00c7htvcrdff83q36kp10a247m212fjpa5ju`

> **A \[Pop-up Method]\(https\://developers.clearpay.co.uk/clearpay-online/reference/popup-method) is also available which uses a \`postMessage\` to communicate the status and token.**

Now that you have the customer's approval of the billing agreement, you can create the Billing Agreement.

## 2. Create Billing Agreement

See [Create Billing Agreement](/draft-create-billing-agreement) for more details.

![](/_fern-img/46e24726260914fe4b6dd3bd3a02610d47795e66dd7caf081aa2bc00f6e909bf.webp)

This API creates the billing agreement, and returns a billing agreement token to you. Keep this token for future transactions.

## Recurring Payments - More Information

* [Recurring Payments](/recurring-payments)
  * [Checkout and Store Clearpay as Payment Method](/checkout-and-store-clearpay-as-payment-method)
  * [Create Recurring Payment](/create-recurring-payment)
  * [Recurring Payments Flow](/draft-recurring-payments-flow)
  * [Setup Billing Agreement Approval](/draft-setup-billing-agreement-approval)
  * [Create Billing Agreement](/draft-create-billing-agreement)
  * [Get Billing Agreement](/draft-get-billing-agreement)
  * [Cancel Billing Agreement](/draft-cancel-billing-agreement)
  * [Create Recurring Payment (Immediate Capture)](/draft-create-recurring-payment-immediate-capture)
  * [Authorise Recurring Payment (Deferred Capture)](/draft-authorise-recurring-payment-deferred-capture)