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

# Transaction Orders History

All transaction orders have supports for bulk fetches view "list" API method. For instance, you can list of all orders.

In order to interact with PAYON's API. First you need to [Obtain your API Key](/platform-application-settings/obtain-your-api-keys.md). Next  generate [API's signature](/getting-started-1/generate-checkout-uri.md#get-signification) for authorization between Merchant and PAYON's server.&#x20;

| Environment | URL                                                            |
| ----------- | -------------------------------------------------------------- |
| TEST        | [http://pgtest.payon.com.kh](http://pgtest.payon.com.kh:36605) |
| PRODUCTION  | [https://pg.payon.com.kh](https://pg.payon.com.kh:35505)       |

## PG Transaction Orders History

<mark style="color:green;">`POST`</mark> `{{URL}}/pg/orders`

These list API share a common structure, taking at least these some parameters **fromDate, ToDate, index, limit, merchantId, termId.**&#x20;

#### Request Body

| Name       | Type   | Description                                                                                                |
| ---------- | ------ | ---------------------------------------------------------------------------------------------------------- |
| merchantId | string | Merchant Identification                                                                                    |
| termId     | string | Merchant Terminal Identification                                                                           |
| fromDate   | string | date format ddmmyyy                                                                                        |
| toDate     | string | date format ddmmyy                                                                                         |
| index      | string | Starting index page                                                                                        |
| limit      | string | A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. |

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

```
[
    {
        "txDt": "20201124",
        "txSeqNo": "2020112400001250",
        "txStCd": "09",
        "trt": "10",
        "payDvCd": "8",
        "paymentType": "02",
        "merchantId": "C0000143",
        "termId": "CT03000003",
        "tracNo": "1606193062038",
        "amount": 1,
        "currencyCode": "USD",
        "settleYn": "N",
        "cancelYn": "N",
        "refundYn": "N",
        "apprNo": "190879",
        "apprDttm": "24/11/2020 11:47:01",
        "resultCd": "0000",
        "resultMsg": "Success",
        "stan": "001032"
    },
    {
        "txDt": "20201124",
        "txSeqNo": "2020112400001251",
        "txStCd": "09",
        "trt": "10",
        "payDvCd": "8",
        "paymentType": "02",
        "merchantId": "C0000143",
        "termId": "CT03000003",
        "tracNo": "1606199421698",
        "amount": 1,
        "currencyCode": "USD",
        "settleYn": "N",
        "cancelYn": "N",
        "refundYn": "N",
        "apprNo": "193202",
        "apprDttm": "24/11/2020 01:30:29",
        "resultCd": "0000",
        "resultMsg": "Success",
        "stan": "001033"
    }
]
```

{% endtab %}
{% endtabs %}

### Example Request

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

```bash
curl --location --request POST 'http://pgtest.payon.com.kh/pg/orders' \
--data-raw '{
    "fromDate":"01112018",
    "toDate":"24112020",
    "index":1,
    "limit":5,
    "trt":"10",
    "merchantId":"C0000143",
    "termId":"CT03000003"
}'
```

{% endtab %}

{% tab title="HTTP" %}

```http
POST /pg/orders HTTP/1.1
Host: pgtest.payon.com.kh

{
    "fromDate":"01112018",
    "toDate":"24112020",
    "index":1,
    "limit":5,
    "trt":"10",
    "merchantId":"C0000143",
    "termId":"CT03000003"
}
```

{% endtab %}

{% tab title="PHP\_Http-Request2" %}

```php
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('http://pgtest.payon.com.kh/pg/orders');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Cookie' => 'SESSION=2e99ea42-84d2-4853-8c24-d5e541673468'
));
$request->setBody('{\n    "fromDate":"01112018",\n    "toDate":"24112020",\n    "index":1,\n    "limit":5,\n    "trt":"10",\n    "merchantId":"C0000143",\n    "termId":"CT03000003"\n}');
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
```

{% endtab %}

{% tab title="PHP\_cURL" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://pgtest.payon.com.kh/pg/orders",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS =>"{\n    \"fromDate\":\"01112018\",\n    \"toDate\":\"24112020\",\n    \"index\":1,\n    \"limit\":5,\n    \"trt\":\"10\",\n    \"merchantId\":\"C0000143\",\n    \"termId\":\"CT03000003\"\n}",
  CURLOPT_HTTPHEADER => array(
    "Cookie: SESSION=2e99ea42-84d2-4853-8c24-d5e541673468"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Javascript\_Jquery" %}

```javascript
var settings = {
  "url": "http://pgtest.payon.com.kh/pg/orders",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Cookie": "SESSION=2e99ea42-84d2-4853-8c24-d5e541673468"
  },
  "data": "{\n    \"fromDate\":\"01112018\",\n    \"toDate\":\"24112020\",\n    \"index\":1,\n    \"limit\":5,\n    \"trt\":\"10\",\n    \"merchantId\":\"C0000143\",\n    \"termId\":\"CT03000003\"\n}",
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}

{% tab title="Javascript\_XHR" %}

```javascript
var data = "{\n    \"fromDate\":\"01112018\",\n    \"toDate\":\"24112020\",\n    \"index\":1,\n    \"limit\":5,\n    \"trt\":\"10\",\n    \"merchantId\":\"C0000143\",\n    \"termId\":\"CT03000003\"\n}";

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "http://pgtest.payon.com.kh/pg/orders");
xhr.setRequestHeader("Cookie", "SESSION=2e99ea42-84d2-4853-8c24-d5e541673468");

xhr.send(data);
```

{% endtab %}
{% endtabs %}
