> For the complete documentation index, see [llms.txt](https://docs.2checkout.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.2checkout.com/soap-api-reference/soap-api-6.0/api-requests/customer/retrieve-customer-orders.md).

# Retrieve customer orders

Use the **getCustomerOrders** method to retrieve the orders belonging to a specific customer, across all of the customer’s subscriptions.

You can identify the customer either by the 2Checkout customer ID (CustomerReference) or by the external customer ID that you assigned (ExternalCustomerReference). The result is paginated, and the orders are sorted by order date, most recent first. An order that is referenced by more than one subscription of the customer is returned only once.

If the customer exists but has no subscriptions, the method returns an empty list of orders instead of an error.

## Request parameters

<table><thead><tr><th width="244.933349609375">Parameters</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>sessionID</code></td><td><strong>Required (string)</strong><br>Session identifier, the output of the <strong>Login</strong> method. Include <code>sessionID</code> into all your requests. 2Checkout throws an exception if the values are incorrect. The <code>sessionID</code> expires in <strong>10 minutes</strong>.</td></tr><tr><td><code>CustomerReference</code></td><td><p><strong>Optional (int)</strong></p><p>The internal 2Checkout customer ID. One of <code>CustomerReference</code> or <code>ExternalCustomerReference</code> is required.</p></td></tr><tr><td><code>ExternalCustomerReference</code></td><td><p><strong>Optional (string)</strong></p><p>The external customer ID that you control. One of <code>CustomerReference</code> or <code>ExternalCustomerReference</code> is required. If you include both, they must belong to the same customer.</p></td></tr><tr><td><code>Page</code></td><td><p><strong>Optional (int)</strong></p><p>Page number, starting from 1. Defaults to 1.</p></td></tr><tr><td><code>Limit</code></td><td><p><strong>Optional (int)</strong></p><p>Number of orders per page. Defaults to 10. Must be between 1 and 200.</p></td></tr></tbody></table>

### Request sample

```php
<?php
require ('PATH_TO_AUTH');
$options = new stdClass();
$options->ExternalCustomerReference = '666';
$options->Page = 1;
$options->Limit = 10;
$jsonRpcRequest = array (
'method' => 'getCustomerOrders',
'params' => array($sessionID, $options),
'id' => $i++,
'jsonrpc' => '2.0');
var_dump (callRPC((Object)$jsonRpcRequest, $host, true));
```

## Response parameters

<table><thead><tr><th width="171.3333740234375">Parameters</th><th>Type / Description</th></tr></thead><tbody><tr><td>Items</td><td><p><strong>Array of objects</strong></p><p>Each item has the same structure as a single order returned by the <code>getOrder</code> method. </p></td></tr><tr><td>Pagination</td><td><p><strong>Object</strong></p><p>Pagination object with the following parameters:</p><p>Page — the requested page.</p><p>Limit — the requested page size.</p><p>Count — the total number of distinct orders of the customer, across all pages. The value is the same even if Page is past the last page of results.</p></td></tr></tbody></table>

## Error codes

| Error code                                | Description                                                                                                                                             |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **FORBIDDEN**                             | The method is not enabled for your account.                                                                                                             |
| **INVALID\_CUSTOMER**                     | Neither CustomerReference nor ExternalCustomerReference was provided, the two references belong to different customers, or the customer does not exist. |
| **PAGINATION\_PAGE\_PARAMETER\_INVALID**  | Page is not a valid integer greater than or equal to 1.                                                                                                 |
| **PAGINATION\_LIMIT\_PARAMETER\_INVALID** | Limit is not between 1 and 200.                                                                                                                         |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.2checkout.com/soap-api-reference/soap-api-6.0/api-requests/customer/retrieve-customer-orders.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
