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

# Checkout and Store Clearpay as Payment Method

> What are the API calls required to setup recurring payments with Clearpay in the context of a transaction?

To enable Recurring Payments functionality, first you setup customer approval for the billing agreement, and then create a Checkout.

> **Make sure you have previously retrieved minimum and maximum order amounts!**
>
> Please see [Create Checkout](/create-checkout-1) for more details on using the *Get Configuration API* to retrieve order limits.

## Create Checkout and Setup Billing Agreement

* [POST /v2/create-checkout](https://developers.clearpay.co.uk/clearpay-online/reference/create-checkout)

![](/_fern-img/c1342304efd72c7c3f287d28162894734ba7583f4fff5dd30ba194e06d17e28c.webp)

Call the Create Checkout endpoint to tell Clearpay information that includes:

* Customer Information
* Order Details
* Order Total
* Shipping Information
* The URL you want the customer to go to when they complete the Clearpay checkout flow

### Agreement Information

The Checkout request must include this field:

```
    "agreements": [
        {
         "type": "BILLING",
         "merchantReference": "merchant-billing-agreement-1234",
         "pageUrl": "https://merchant.com/billing-agreement"
        }
    ],  
```

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

This token is used with the [Clearpay JavaScript library](/javascript-library) to direct the customer to the Clearpay checkout flow.

![](/_fern-img/3efae8e3c15758ba088761ba33f12f977349b54525526208524bd4a8a49ff1ad.webp)

After the customer completes the checkout flow they are returned to the Merchant website URL provided in the *Create Checkout* request. If using the [redirect method](https://developers.clearpay.co.uk/clearpay-online/reference/standard-checkout#redirect-method) the URL has a status appended to the Merchant URL. For Example:

* If the customer successfully completes the checkout 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 \[popup method]\(../reference#popup-method) is also available which uses a \`postMessage\` to communicate the status and token.**

## Choose When You Want to Capture the Order

Now that you have a successful pre-approval for the checkout you can either [capture the order directly](/selecting-a-payment-flow)  or create an [Auth](https://developers.clearpay.co.uk/clearpay-online/reference/auth) API call. The Auth API call places funds on hold until you are ready to capture.

Both methods allow you to create the Billing Agreement which was approved by the customer.

## Capture Order and Create Billing Agreement

* [POST /v2/payments/capture](https://developers.clearpay.co.uk/clearpay-online/reference/capture-full-payment)

![](/_fern-img/784a12ff2ac26eb589994c9cd3b3577c8e445b2fcc2f94ad756c5cdab8907016.webp)

This API captures the order and creates the billing agreement, returning to you a *paymentid* for the checkout order and a billing agreement token. Save this token for future transactions.

## 2b. Authorize Order and Create Billing Agreement

* [POST /v2/payments/auth](https://developers.clearpay.co.uk/clearpay-online/reference/auth)

![](/_fern-img/679662a70e3846ce1cb00763e21ed13b44e7284eb031db41c1444c7ea955f481.webp)![](/_fern-img/d2f92e804903ab84a2c847a2c5f578a915a948db3598a022a94db8800d3033f4.webp)

This API authorizes the order and creates the billing agreement, returning to you a *paymentId* for the checkout order and a billing agreement token. Save this token for future transactions.

Next, for the checkout order, you can capture the authorization or do multiple partial captures.   See the [Deferred Payment Flow](https://developers.clearpay.co.uk/clearpay-online/reference/deferred-payment-flow) for details.

For the Billing Agreement, you can make recurring payments using the saved billing agreement token.

## Recurring Payments - More Information

* [Recurring Payments](/recurring-payments)
  * [Store Clearpay as a Payment Method](/store-clearpay-as-a-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)