# Payment History

Use this endpoint to retrieve a list of payments belonging to a specific business. You can apply filters to the list based on various criteria, such as time range, payment status, amount, payment method, and more. Additionally, you can paginate the results using the \`page\` and \`size\` parameters.

<mark style="color:green;">`POST`</mark> `https://api.oxapay.com/merchants/list`

#### Request Body

<table><thead><tr><th width="179">Name</th><th width="100">Type</th><th width="473">Description</th></tr></thead><tbody><tr><td>merchant<mark style="color:red;">*</mark></td><td>string</td><td>Your merchant API key for authentication and authorization.</td></tr><tr><td>orderBy</td><td>string</td><td>Display the list in ascending or descending order. Possible values: 'asc', 'desc'. Default: 'desc'.</td></tr><tr><td>sortBy</td><td>string</td><td>Sort the received list by a parameter. Possible values: 'create_date', 'pay_date', 'amount'. Default: 'create_date'.</td></tr><tr><td>trackId</td><td>integer</td><td>Filter payments by a specific invoice ID.</td></tr><tr><td>page</td><td>integer</td><td>The page number of the results you want to retrieve. Possible values: from 1 to the total number of pages - default 1.</td></tr><tr><td>size</td><td>integer</td><td>Number of records to display per page. Possible values: from 1 to 200. Default: 10.</td></tr><tr><td>orderId</td><td>string</td><td>Filter payments by a unique order ID for reference.</td></tr><tr><td>status</td><td>string</td><td>Filter payments by status (e.g., "Paid", "Confirming").</td></tr><tr><td>feePaidByPayer</td><td>decimal</td><td>Filter payments based on whether the payer covers the invoice commission (1) or the merchant covers it (0).</td></tr><tr><td>type</td><td>string</td><td>Filter payments by type (e.g. "invoice", "white_label", "static_address").</td></tr><tr><td>network</td><td>string</td><td>Filter payments by the expected <a href="supported-networks">blockchain network</a> for the specified crypto currency.</td></tr><tr><td>payCurrency</td><td>string</td><td>Filter payments by a specific crypto <a href="supported-currencies">currency symbol</a> in which the pay amount is specified.</td></tr><tr><td>currency</td><td>string</td><td>Filter payments by a specific <a href="supported-currencies">currency symbol</a>.</td></tr><tr><td>toAmount</td><td>float</td><td>Filter payments with amounts less than or equal to the specified value.</td></tr><tr><td>fromAmount</td><td>float</td><td>Filter payments with amounts greater than or equal to the specified value.</td></tr><tr><td>toDate</td><td>string</td><td>The end of the date window to query for invoices in unix format</td></tr><tr><td>fromDate</td><td>string</td><td>The start of the date window to query for invoices in unix format</td></tr><tr><td>address</td><td>string</td><td>Filter payments by the expected address. It’s better to filter static addresses.</td></tr><tr><td>txID</td><td>string</td><td>Filter the payment with your transaction hash</td></tr></tbody></table>

{% tabs %}
{% tab title="200: OK " %}

```json
{
  "result": integer, // The result code indicates the success or failure of the request.
  "message": string, // A message providing additional information about the result.
  "data": array, // An array containing the list of payment information if the request is successful.
  "meta": object // including size, page, pages, total.
}
```

{% endtab %}
{% endtabs %}

Please note that a successful request will return a result code 100. In case of any issues or validation problems, refer to the corresponding [result codes](https://docs.oxapay.com/legacy/api-reference/result-code-table) for further details.

### Example codes

{% tabs %}
{% tab title="cURL" %}

<pre class="language-bash"><code class="lang-bash">curl -X POST https://api.oxapay.com/merchants/list \
  -d '{
    "merchant": "YOUR_MERCHANT_API_KEY",
<strong>    "fromDate": 1690848000,
</strong>    "toDate": 1691625600,
    "size": 20,
    "page": 1
  }'
</code></pre>

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$url = 'https://api.oxapay.com/merchants/list';

$data = array(
    'merchant' => 'YOUR_MERCHANT_API_KEY',
    'fromDate' => 1690848000,
    'toDate' => 1691625600,
    'size' => 20,
    'page' => 1
);

$options = array(
    'http' => array(
        'header' => 'Content-Type: application/json',
        'method'  => 'POST',
        'content' => json_encode($data),
    ),
);

$context  = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$result = json_decode($response);
var_dump($result);
?>
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const axios = require('axios');
const url = 'https://api.oxapay.com/merchants/list';
const data = JSON.stringify({
    merchant: 'YOUR_MERCHANT_API_KEY',
    fromDate: 1690848000,
    toDate: 1691625600,
    size: 20,
    page: 1
});

axios.post(url, data)
    .then(response => {
        console.log(response.data);
    })
    .catch(error => {
        console.error(error);
    });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

url = 'https://api.oxapay.com/merchants/list'
data = {
    'merchant': 'YOUR_MERCHANT_API_KEY',
    'fromDate': 1690848000,
    'toDate': 1691625600,
    'size': 20,
    'page': 1
}
response = requests.post(url, data=json.dumps(data))
result = response.json()
print(result)
```

{% endtab %}
{% endtabs %}

Now you have the example code snippets in cURL, PHP, Node.js, and Python for making a request to the Payment History endpoint. Feel free to use these examples to integrate the OxaPay API into your application or website and retrieve payment information based on your specified criteria.
