Checkout and Store Clearpay as Payment Method
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 for more details on using the Get Configuration API to retrieve order limits.
Create Checkout and Setup Billing Agreement

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:
Clearpay responds with a token used to identify this checkout flow.
e.g. 003.5lmerr3k945d00c7htvcrdff83q36kp10a247m212fjpa5ju
This token is used with the Clearpay JavaScript library to direct the customer to the Clearpay checkout flow.

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 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 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 or create an 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

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

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 for details.
For the Billing Agreement, you can make recurring payments using the saved billing agreement token.