# Payment history

Returns a list of invoices

**POST** `https://api.heleket.com/v1/payment/list`

## Request

### Body parameters

| Name | Parameter type | Default value | Definition |
| --- | --- | --- | --- |
| date\_from | string<br>format: YYYY-MM-DD H:mm:ss| null | Filtering by creation date, from |
| date\_to | string<br>format: YYYY-MM-DD H:mm:ss| null | Filtering by creation date, to |

### Request example

```
curl https://api.heleket.com/v1/payment/list \
-X POST \
-H 'merchant: 8b03432e-385b-4670-8d06-064591096795' \
-H 'sign: f80fa426a89eb62bd53997326865d850' \
-H 'Content-Type: application/json' \
-d '{}'
```

To filter invoices by creation date from may 4 to may 16.

```
curl https://api.heleket.com/v1/payment/list \
-X POST \
-H 'merchant: 8b03432e-385b-4670-8d06-064591096795' \
-H 'sign: f80fa426a89eb62bd53997326865d850' \
-H 'Content-Type: application/json' \
-d '{
	"date_from": "2023-05-04 00:00:00",
	"date_to": "2023-05-16 23:59:59"
}'
```

## Response

### Response parameters

| Name | Definition |
| --- | --- |
| items | Array of invoices. [Structure of item](https://doc.heleket.com/methods/payments/creating-invoice.md#response_parameters) |
| paginate | Data for pagination. [Structure](https://doc.heleket.com/methods/payments/payment-history.md#paginate) |

### Structure of _paginate_

| Name | Parameter type | Definition |
| --- | --- | --- |
| count | integer | Number of items on the current page |
| hasPages | boolean | Whether there are enough elements to split into multiple pages (true / false) |
| nextCursor | string / null | Cursor to next page |
| previousCursor | string / null | Cursor to previous page |
| perPage | integer | Maximum number of elements per page |

> To get next/previous page entries, specify the next/previous cursor hash in the query parameters (?cursor=nextCursorHash)
> 
> ### Example:
> 
> ```
> curl https://api.heleket.com/v1/payment/list?cursor=eyJpZCI6MjEyLCJ fcG9pbnRzVzVG9OZhXh0SXRlbXMiOnRydWV9 \
> -X POST \
> -H 'merchant: 8b03432e-385b-4670-8d06-064591096795' \
> -H 'sign: f80fa426a89eb62bd53997326865d850' \
> -H 'Content-Type: application/json' \
> -d '{}'
> ```

### Response example

```
{
	"state": 0,
	"result": {
		"items": [{
			"uuid": "ac1af391-8e98-4335-b9d7-7b6f6b40f268",
			"order_id": "20fe59c4601dd174985e497e3f6bbcd2",
			"amount": "20.00",
			"payment_amount": "0.00000000",
			"payer_amount": "0.00064860",
			"discount_percent": 0,
			"discount": "0.00000000",
			"payer_currency": "BTC",
			"currency": "USD",
			"merchant_amount": null,
			"comments": null,
			"network": "btc",
			"address": "bc1qxm6ehuy6mz2l2h3ag88frcjvl2xxlr9hvnq835",
			"from": null,
			"txid": null,
			"payment_status": "cancel",
			"url": "https:\/\/pay.heleket.com\/pay\/ac1af391-8e98-4335-b9d7-7b6f6b40f268",
			"expired_at": 1689172103,
			"status": "cancel",
			"is_final": true,
			"additional_data": null,
			"created_at": "2023-07-12T16:28:24+03:00",
			"updated_at": "2023-07-12T17:30:16+03:00"
		}, {
			"uuid": "1bb48358-2905-4e98-b681-5f1948e818d1",
			"order_id": "a3329f462eb036dad12b5409147809a3",
			"amount": "15.00",
			"payment_amount": "0.00",
			"payer_amount": "14.25",
			"discount_percent": 5,
			"discount": "0.75",
			"payer_currency": "USDT",
			"currency": "USDT",
			"merchant_amount": "15.43500000",
			"comments": null,
			"network": "tron",
			"address": "TSChodGNEJ6D31d9uueFxJAVH9NxiJjTwC",
			"from": null,
			"txid": null,
			"payment_status": "cancel",
			"url": "https:\/\/pay.heleket.com\/pay\/1bb48358-2905-4e98-b681-5f1948e818d1",
			"expired_at": 1689099958,
			"status": "cancel",
			"is_final": true,
			"additional_data": null,
			"created_at": "2023-07-11T20:25:58+03:00",
			"updated_at": "2023-07-11T21:26:18+03:00"
		}, {
			"uuid": "70b8db5c-b952-406d-af26-4e1c34c27f15",
			"order_id": "65bbe87b4098c17a31cff3e71e515243",
			"amount": "15.00",
			"payment_amount": "0.00",
			"payer_amount": "15.75",
			"discount_percent": -5,
			"discount": "-0.75",
			"payer_currency": "USDT",
			"currency": "USDT",
			"merchant_amount": "15.43500000",
			"comments": null,
			"network": "tron",
			"address": "TXhfYSWt2oKRrHAJVJeYRuit6ZzKuoEKXj",
			"from": null,
			"txid": null,
			"payment_status": "cancel",
			"url": "https:\/\/pay.heleket.com\/pay\/70b8db5c-b952-406d-af26-4e1c34c27f15",
			"expired_at": 1689099831,
			"status": "cancel",
			"is_final": true,
			"additional_data": null,
			"created_at": "2023-07-11T20:23:52+03:00",
			"updated_at": "2023-07-11T21:24:17+03:00"
		},
		...
],
		"paginate": {
			"count": 15,
			"hasPages": true,
			"nextCursor": "eyJpZCI6MjkxNTU0MywiX3BvaW50c1RvTmV4dEl0ZW1zIjp0cnVlfQ",
			"previousCursor": null,
			"perPage": 15
		}
	}
}
```

## Possible errors

### Validation errors

code : 422

example responses:

If the _date\_from_ or _date\_to_ parameter is passed in the wrong format:

```
{
	"state": 1,
	"errors": {
		"date_from": ["validation.regex"]
	}
}
```
