> This page is for version v2 (default).
> For other versions, use one of these documentation indexes:
> - v2 (default): https://developers.clearpay.co.uk/v-2/llms.txt
> - v1: https://developers.clearpay.co.uk/v-1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.clearpay.co.uk/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.clearpay.co.uk/_mcp/server.

# List Payments

GET https://global-api-sandbox.afterpay.com/v2/payments

This endpoint retrieves a collection of payments along with their order details.

## Successful Response (200)

Returns the matching [Payment](/payment-object) objects, enclosed in a [Pagination](/pagination) object.

## Connection Timeouts

| Timeout | Time (Seconds) |
| :------ | :------------- |
| Open    | 10             |
| Read    | 20             |

## Errors

In addition to the [GET Errors](/get-errors) applicable to all GET endpoints, the following errors are specific to List Payments:

| HTTP Status Code               | errorCode | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| :----------------------------- | :-------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **422**  Unprocessable Entity  | `error`   | An invalid query param was provided.For example, a value for `limit` was provided, but was less than 1 or more than 250.                                                                                                                                                                                                                                                                                                                                                                           |
| **500**  Internal Server Error | `error`   | This is usually caused by sending a `fromCreatedDate` or `toCreatedDate` in an invalid format. Please ensure the dash and colon characters are included, and any plus characters are URL-encoded. See [Example Request 1](#example-request-1).Also, for the array parameters (`ids`, `tokens`, `merchantReferences` and `statuses`), do not use comma-separated values or square brackets. Instead, include each parameter multiple times, as needed. See [Example Request 2](#example-request-2). |

## Example Request 1

The following example searches for all Clearpay Orders placed within two timestamps, using a local timezone. Note that the plus character must be URL-encoded.

The request that is automatically generated by Readme appears as though it URL-encodes the Query Params. However, the request that is actually delivered to Clearpay when clicking the "Try It" button does not include any URL-encoding.

Please specifically replace "+" characters with "%2b" when testing a `fromCreatedDate` or `toCreatedDate` with a timezone ahead of UTC.

```curl cURL
curl https://global-api.afterpay.com/v2/payments?fromCreatedDate=2019-01-01T09:00:00.000%2b01:00&toCreatedDate=2019-01-01T17:00:00.000%2b01:00 \
  -H 'Authorization: Basic <Base64EncodedCredentials>' \
  -H 'User-Agent: <MyUserAgent>' \
  -H 'Accept: application/json'
```

## Example Request 2

The following example searches for all Clearpay Orders matching a list of tokens. Note that the tokens parameter is included several times, once for each token.

```curl
curl https://api.eu-sandbox.afterpay.com/v2/payments?tokens=abcdefgh&tokens=ijklmnop \
  -H 'Authorization: Basic <Base64EncodedCredentials>' \
  -H 'User-Agent: <MyUserAgent>' \
  -H 'Accept: application/json'
```

Reference: https://developers.clearpay.co.uk/api-reference/list-payments

## Authentication

- `Authorization` header (basic auth, required) — Basic authentication of the form `Basic <base64(username:password)>`.

## Request

### Query parameters

- `toCreatedDate` (string, optional) — An inclusive end date and time to search, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format.
- `fromCreatedDate` (string, optional) — An inclusive start date and time to search, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format.
- `limit` (integer, optional, default: 20) — The number of results to retrieve from a query. Must be between 1 and 250 (inclusive).
- `offset` (integer, optional, default: 0) — The position on the page to start the results. The first result has a position of 0.
- `includeNextLink` (boolean, optional, default: false) — Will return a modified pagination object which includes a url to return the next page. The default value is false
- `tokens` (list of string, optional) — One or more order tokens to search for.
- `ids` (list of string, optional) — One or more Clearpay Order IDs to search for.
- `merchantReferences` (list of string, optional) — One or more Merchant Reference IDs to search for.
- `statuses` (list of string, optional) — One or more Clearpay Order Statuses to search for. Possible values include "APPROVED" and "DECLINED".
- `orderBy` (string, optional, default: createdAt) — A field to order results by. If provided, must be one of "createdAt", "id", "totalAmount", "merchantReference" or "email".
- `ascending` (boolean, optional, default: false) — `true` to order results in ascending order, or `false` for descending order.

### Headers

- `Accept` (string, optional, default: application/json)

## Examples

**SDK Code**

```python
import requests

url = "https://global-api-sandbox.afterpay.com/v2/payments"

headers = {
    "User-Agent": "User-Agent"
}

response = requests.get(url, headers=headers, auth=("<username>", "<password>"))

print(response.json())
```

```javascript
const url = 'https://global-api-sandbox.afterpay.com/v2/payments';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'GET',
  headers: {'User-Agent': 'User-Agent', Authorization: `Basic ${credentials}`}
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://global-api-sandbox.afterpay.com/v2/payments"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("User-Agent", "User-Agent")
	req.SetBasicAuth("<username>", "<password>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://global-api-sandbox.afterpay.com/v2/payments")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["User-Agent"] = 'User-Agent'
request.basic_auth("<username>", "<password>")

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://global-api-sandbox.afterpay.com/v2/payments")
  .header("User-Agent", "User-Agent")
  .basicAuth("<username>", "<password>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://global-api-sandbox.afterpay.com/v2/payments', [
  'headers' => [
    'User-Agent' => 'User-Agent',
  ],
    'auth' => ['<username>', '<password>'],
]);

echo $response->getBody();
```

```csharp
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://global-api-sandbox.afterpay.com/v2/payments");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.GET);
request.AddHeader("User-Agent", "User-Agent");

IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = [
  "User-Agent": "User-Agent",
  "Authorization": "Basic \(credentials)"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://global-api-sandbox.afterpay.com/v2/payments")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```