For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
HomeGuidesAPI Reference
HomeGuidesAPI Reference
  • Introduction to Clearpay
    • Getting Started with Clearpay Online
    • Business Hub
    • Marketing Resources
  • Platforms
    • Platforms Quickstart
    • Adobe Commerce (Magento 2)
    • Adyen
    • Ecwid
    • Shopify
    • Stripe
    • Wix
    • WooCommerce
  • API Development
    • API Quickstart
    • Test Environments
    • Certification
      • Checkout and Store Clearpay as Payment Method
  • Clearpay Messaging
    • Getting Started
    • Implementation
    • Migration
    • Launch Clearpay Info Modal Anywhere
LogoLogo
On this page
  • Create Checkout and Setup Billing Agreement
  • Agreement Information
  • Choose When You Want to Capture the Order
  • Capture Order and Create Billing Agreement
  • 2b. Authorize Order and Create Billing Agreement
  • Recurring Payments - More Information
API Developmentrecurring-payments

Checkout and Store Clearpay as Payment Method

Was this page helpful?
Previous

Getting Started

Next
Built with

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

  • POST /v2/create-checkout
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:

"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 to direct the customer to the Clearpay checkout flow.

Afterpay Checkout with Billing Agreement Approval - this is the same as Clearpay

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

  • POST /v2/payments/capture
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

  • POST /v2/payments/auth
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.

Recurring Payments - More Information

  • Recurring Payments
    • Store Clearpay as a Payment Method
    • Create Recurring Payment
    • Recurring Payments Flow
    • Setup Billing Agreement Approval
    • Create Billing Agreement
    • Get Billing Agreement
    • Cancel Billing Agreement
    • Create Recurring Payment (Immediate Capture)
    • Authorise Recurring Payment (Deferred Capture)