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

Draft Setup Billing Agreement Approval

Was this page helpful?
Previous

Getting Started

Next
Built with

A billing agreement is a contract between the merchant and the customer. Clearpay sets the agreement that authorises the merchant to create and pay for orders. This step sets up the Billing Agreement ready for it to be created.

The process starts with the following POST:

POST /v2/billing-agreements/approvals

This offers billing agreement terms to the customer for them to accept or reject. Assuming they accept the billing agreement terms, the flow continues. A sample request is:

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

Request Parameters

NameInTypeRequiredDescription
bodybodyBillingAgreementApprovalRequestNo

Example Request Body

1{
2 "consumer": {
3 "phoneNumber": "0400 000 000",
4 "givenNames": "Joe",
5 "surname": "Customer",
6 "email": "test@example.com"
7 },
8 "agreements": [
9 {
10 "type": "BILLING",
11 "merchantReference": "merchant-billing-agreement-1234",
12 "pageUrl": "https://merchant.com/payment-methods"
13 }
14 ],
15 "merchantReference": "merchant-payment-method-registration-1234",
16 "merchant": {
17 "redirectConfirmUrl": "http://merchant.com/confirm",
18 "redirectCancelUrl": "http://merchant.com/cancel"
19 }
20}

Responses

StatusMeaningDescriptionSchema
200OKSucessfulCheckoutTokenResponse

Example Responses

200 Response

1{
2 "expires": "2019-08-24T14:15:22Z",
3 "token": "003._7IgXzApNiRoxpEb04LbAFQShsvdE_H3",
4 "redirectCheckoutUrl": "https://afterpay.com/checkout"
5}
Warning - tokens

Recurring Payments needs two tokens. The token above is the Billing Agreement token. There is also a Checkout token. Do not confuse the two tokens.

Note

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

Now the Billing Agreement is setup, you must create the Billing Agreement itself. See the Create Billing Agreement topic 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
    • Create Billing Agreement
    • Get Billing Agreement
    • Cancel Billing Agreement
    • Create Recurring Payment (Immediate Capture)
    • Authorise Recurring Payment (Deferred Capture)