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
  • Reference
    • Introduction
      • POSTCreate Billing Agreement
      • POSTCreate Billing Agreement Alias
      • POSTStart Billing Agreement Approval Process
      • PUTCancel Billing Agreement (Alternative)
      • POSTRetrieve Billing Agreement Offers
      • POSTRetrieve Billing Agreement
      • POSTStart Billing Agreement Link Flow
      • GETGet Billing Agreement Details
      • DELCancel Billing Agreement
      • POSTCapture Full Recurring Payment
      • POSTAuthorize Recurring Payment
LogoLogo
ReferenceBilling Agreements (Deprecated)

Cancel Billing Agreement

DELETE
/v2/billing-agreements/:token
DELETE
/v2/billing-agreements/:token
$curl -X DELETE https://global-api-sandbox.afterpay.com/v2/billing-agreements/token \
> -H "User-Agent: User-Agent" \
> -u "<username>:<password>"
1{
2 "token": "005.2fkv5o963b132z8ppa34srlh60987y87d55re237wsg9tr4q2",
3 "type": "BILLING",
4 "status": "ACTIVE",
5 "created": "2024-03-04T12:00:00Z",
6 "merchantReference": "merchant_ref_123",
7 "cancelled": "2024-03-05T12:00:00Z",
8 "expires": "2025-03-04T12:00:00Z",
9 "events": [
10 {
11 "type": "CAPTURE",
12 "created": "2024-03-04T10:30:00Z",
13 "amount": {
14 "amount": "100.00",
15 "currency": "AUD"
16 },
17 "status": "APPROVED",
18 "merchantReference": "merchant-event-ref-789",
19 "orderId": 123
20 }
21 ],
22 "requestId": "req_abc123def456",
23 "consumerReference": "cust_12345",
24 "email": "j***@e***.com"
25}
Cancels an existing billing agreement using its token. *Deprecated. For new integrations, see [Grants](https://afterpay.docs.buildwithfern.com/afterpay-online-developer/api-reference/reference/grants/start-grant-approval).*
Was this page helpful?
Previous

Capture Full Recurring Payment

Next
Built with

Cancels an existing billing agreement using its token.

Deprecated. For new integrations, see Grants.

Authentication

AuthorizationBasic

Basic authentication of the form Basic <base64(username:password)>.

Path parameters

tokenstringRequired
The unique identifier token of the billing agreement to cancel

Headers

User-AgentstringRequired

Response

Billing agreement cancelled successfully
tokenstring
Unique token identifying the agreement
typeenum
Type of agreement
Allowed values:
statusenum
Current status of the agreement
Allowed values:
createdstringformat: "date-time"
Timestamp when the agreement was created
merchantReferencestring or null
Merchant's reference for this agreement
cancelledstringformat: "date-time"
If present, indicates when the agreement was cancelled
expiresstringformat: "date-time"
If present, indicates when the agreement's status will become EXPIRED, preventing a client from using it to create payments
eventslist of objects
List of events associated with this agreement
requestIdstring or null
Unique identifier for the request
consumerReferencestring or null
Reference identifier for the consumer
emailstring or null
Masked email address of the consumer

Errors

403
Forbidden Error
404
Not Found Error