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
      • Draft Create Billing Agreement
  • Clearpay Messaging
    • Getting Started
    • Implementation
    • Migration
    • Launch Clearpay Info Modal Anywhere
LogoLogo
On this page
  • Recurring Payments - More Information
API Developmentrecurring-payments

Draft Create Billing Agreement

Was this page helpful?
Previous

Getting Started

Next
Built with

A billing agreement is a contract between you the merchant, and the customer. The agreement authorises you to create and pay for orders. This step creates the Billing Agreement once the customer has asked for the Billing Agreement.

The process starts with the following POST:

POST /v2/billing-agreements

This finalises the Billing Agreement after the Billing Agreement has been approved by the customer. A sample request is:

1POST https://api-sandbox.afterpay.com/v2/billing-agreements HTTP/1.1
2Host: api-sandbox.afterpay.com
3Content-Type: application/json
4Accept: application/json

Request Parameters

NameInTypeRequiredDescription
bodybodyAuthRequestNo

Example Request Body

1{
2 "requestId": "259380f5-a9ac-4607-b987-d9c4baa34f83",
3 "token": "ltqdpjhbqu3veqikk95g7p3fhvcchfvtlsiobah3u4l5nln8gii9",
4 "merchantReference": "merchantOrderId-1234"
5}

Responses

StatusMeaningDescriptionSchema
200OKSuccessfulAgreement

Example Responses

200 Response

1{
2 "token": "_7IgXzApNiRoxpEb04LbAFQShsvdE_H3",
3 "type": "BILLING",
4 "status": "ACTIVE",
5 "merchantReference": "merchant-billing-agreement-1234",
6 "created": "2021-04-16T02:49:04.740Z",
7 "cancelled": null,
8 "expires": null
9}
Note

To handle the response, you must be authenticated by MerchantAuthentication.

Now the Billing Agreement is created, the next task is to send it where it is needed. See the Get Billing Agreementtopic for that information.

Recurring Payments - More Information

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