API Developmentrecurring-payments

Draft Get Billing Agreement

This step retrieves the Billing Agreement to an endpoint, once the Billing Agreement has been setup and created.

The process starts with the following GET:

GET /v2/billing-agreements/{token}

This endpoint retrieves a billing agreement. A sample request is:

1GET https://api-sandbox.afterpay.com/v2/billing-agreements/{token} HTTP/1.1
2Host: api-sandbox.afterpay.com
3Accept: application/json

Request Parameters

NameInTypeRequiredDescription
tokenpathstringtrueThe token of the agreement to be retrieved.

Responses

StatusMeaningDescriptionSchema
200OKSuccessfulAgreement
401UnauthorizedInvalid Merchant API credentials were passed in the Authorization header.Error
404Not FoundThe agreement with this ID could not be found.Error
405Method Not AllowedThe request was made using an unacceptable HTTP method. Depending on the endpoint, only PUT or POST requests are allowed. Use the OPTIONS HTTP method to determine which methods are allowed for each endpoint.Error
406Not AcceptableThe request included an Accept header for something other than application/json or /.Error
500Internal Server ErrorCommonly this response from PUT/POST endpoints is caused by the request body that is missing or empty.Error

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}

401 Response

1{
2 "errorCode": "unauthorized",
3 "errorId": "16628d4fb02900d4",
4 "message": "Credentials are required to access this resource.",
5 "httpStatusCode": 401
6}

404 Response

1{
2 "errorCode": "not_found",
3 "errorId": "16628d4fb02900d4",
4 "message": "Not found",
5 "httpStatusCode": 404
6}

405 Response

1{
2 "errorCode": "method_not_allowed",
3 "errorId": "16628d4fb02900d4",
4 "message": "Method not allowed",
5 "httpStatusCode": 405
6}

406 Response

1{
2 "errorCode": "error",
3 "errorId": "16628d4fb02900d4",
4 "message": "Not acceptable",
5 "httpStatusCode": 406
6}

500 Response

1{
2 "errorCode": "error",
3 "errorId": "16628d4fb02900d4",
4 "message": "Internal server error",
5 "httpStatusCode": 500
6}
Note

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

Sometimes a Billing Agreement has to be cancelled. For information on this, see the Cancel Billing Agreement topic.

Recurring Payments - More Information