# Get Pay-Out Transaction History

This endpoint allows you to retrieve the history of all Pay-In transactions associated with your merchant account. The results are paginated, allowing you to specify the number of rows and the page number.

#### Endpoint

<mark style="color:green;">**`GET`**</mark>`https://api.tylt.money/transactions/merchant/getPayinTransactionHistory?rows={numberRows}20&page={pagenumber}`

#### Endpoint Example

<mark style="color:green;">**`GET`**</mark>`https://api.tylt.money/transactions/merchant/getPayinTransactionHistory?rows=20&page=1`

**Request Headers**

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

<table data-full-width="true"><thead><tr><th width="133">Name</th><th width="79">Type</th><th width="167">Example</th><th>Description</th></tr></thead><tbody><tr><td>X-TLP-APIKEY</td><td>string</td><td>93ee3c5e133697251b5362bcf9cc8532476785t8768075616f58d88</td><td>Your Tylt API Key, used to identify your account in API requests.</td></tr><tr><td>X-TLP-SIGNATURE</td><td>string</td><td>d0afef3853dfc8489c8b9affa5825171fdd7y7685675e4966a05f66ed2b3eaf9462b3c9c0</td><td>HMAC SHA-256 signature generated using the API Secret Key to secure the request.</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

{% hint style="info" %}
When using the API, ensure to include your API Key and generate the signature for the request payload using your API Secret. The tables provided above contain example values for illustration purposes only. Please refer to the code snippets for detailed instructions on how to sign the request and generate the signature properly.
{% endhint %}

**Code Snippet**

{% tabs %}
{% tab title="Node JS" %}

```javascript
const axios = require('axios');
const crypto = require('crypto');

// Replace with your API Key and Secret
const apiKey = 'your-api-key';
const apiSecret = 'your-api-secret';

// Create signature for the GET request
const params = {rows:20,page:1};
const queryParams = new URLSearchParams(params).toString();
const signature = crypto.createHmac('sha256', apiSecret)
  .update( JSON.stringify(params) )
  .digest('hex');

const config = {
  method: 'get',
  url: `https://api.tylt.money/transactions/merchant/getPayoutTransactionHistory?${queryParams}`,
  headers: {
    "X-TLP-APIKEY": apiKey,
    "X-TLP-SIGNATURE": signature
  }
};

axios(config)
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error(error);
  });

```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import hmac
import hashlib

# Replace with your API Key and Secret
api_key = 'your-api-key'
api_secret = 'your-api-secret'

# Create signature for the GET request
params = {"rows":"20","page":"1"}
query_params = '&'.join([f"{key}={value}" for key, value in params.items()])
body_string = json.dumps(params, separators=(',', ':'), ensure_ascii=False)

signature = hmac.new(api_secret.encode(), body_string.encode(), hashlib.sha256).hexdigest()

url = f"https://api.tylt.money/transactions/merchant/getPayoutTransactionHistory?{query_params}"

headers = {
    "X-TLP-APIKEY": api_key,
    "X-TLP-SIGNATURE": signature
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
    print("Response:", response.json())
else:
    print(f"Failed with status code {response.status_code}: {response.text}")

```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const crypto = require('crypto');
const fetch = require('node-fetch');

// Replace with your API Key and Secret
const apiKey = 'your-api-key';
const apiSecret = 'your-api-secret';

// Create signature for the GET request
const params = {rows:20,page:1};
const queryParams = new URLSearchParams(params).toString();

const signature = crypto.createHmac('sha256', apiSecret)
  .update( JSON.stringify(params) )
  .digest('hex');

const url = `https://api.tylt.money/transactions/merchant/getPayoutTransactionHistory?${queryParams}`;

const headers = {
  "X-TLP-APIKEY": apiKey,
  "X-TLP-SIGNATURE": signature
};

fetch(url, {
  method: 'GET',
  headers: headers,
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));

```

{% endtab %}
{% endtabs %}

**Response**

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

```json
{
    "data": [
        {
            "orderId": "74ea3ace-7740-11ef-8277-02d8461243e9",
            "merchantOrderId": "74ea3ace-7740-11ef-8277-02d8461243e9",
            "settledCurrency": "USDT",
            "settledAmountRequested": 0.1,
            "settledAmountDebited": 0,
            "settledAmountSent": 0,
            "commission": 0,
            "network": "BSC",
            "toAddress": "0xh22kbbq3hbth4bjwh433adgda",
            "status": "Pending",
            "insufficientBalance": 0,
            "paymentURL": "",
            "callBackURL": "",
            "transactions": [],
            "createdAt": "2024-09-20T11:06:59Z",
            "expiresAt": "2024-09-20T11:06:59Z",
            "updatedAt": "2024-09-20T11:06:59Z",
            "isFinal": 0,
            "isDebited": 0,
            "customerName": "",
            "comments": ""
        },
        {
            "orderId": "cc2b2c95-7699-11ef-8277-02d8461243e9",
            "merchantOrderId": "cc2b2c95-7699-11ef-8277-02d8461243e9",
            "settledCurrency": "USDT",
            "settledAmountRequested": 1,
            "settledAmountDebited": 0,
            "settledAmountSent": 0,
            "commission": 0,
            "network": "TPNK",
            "toAddress": "2828a803-72a7-11ef-8277-02d8461243e9",
            "status": "Completed",
            "insufficientBalance": 0,
            "paymentURL": "",
            "callBackURL": "",
            "transactions": [
                {
                    "amount": 1,
                    "createdAt": "2024-09-19 15:13:59.000000",
                    "updatedAt": "2024-09-19 15:13:59.000000",
                    "fromAddress": "2828a803-72a7-11ef-8277-02d8461243e9",
                    "transactionHash": "cc2fe789-7699-11ef-8277-02d8461243e9",
                    "confirmationStatus": 1
                }
            ],
            "createdAt": "2024-09-19T15:13:59Z",
            "expiresAt": "2024-09-19T15:13:59Z",
            "updatedAt": "2024-09-19T15:13:59Z",
            "isFinal": 1,
            "isDebited": 1,
            "customerName": "",
            "comments": ""
        },            
        {
            "orderId": "3249f4a4-7693-11ef-8277-02d8461243e9",
            "merchantOrderId": "3249f4a4-7693-11ef-8277-02d8461243e9",
            "settledCurrency": "USDT",
            "settledAmountRequested": 1,
            "settledAmountDebited": 1,
            "settledAmountSent": 1,
            "commission": 0,
            "network": "BSC",
            "toAddress": "0xd2AF4B117EfE474B66Fc79E6A8E1938D41a60F4c",
            "status": "Completed",
            "insufficientBalance": 0,
            "paymentURL": "",
            "callBackURL": "",
            "transactions": [
                {
                    "amount": 1,
                    "createdAt": "2024-09-19 14:26:53.000000",
                    "updatedAt": "2024-09-19 14:27:42.000000",
                    "fromAddress": "0x1B3ec402Df254a66B97DE199541295AF2e0F5baA",
                    "transactionHash": "0xf7b0c37e5113311ab9f87f0df81c4e2b77cac04fd767862e23de1b63bd06a140",
                    "confirmationStatus": 1
                }
            ],
            "createdAt": "2024-09-19T14:26:44Z",
            "expiresAt": "2024-09-19T14:26:44Z",
            "updatedAt": "2024-09-19T14:27:42Z",
            "isFinal": 1,
            "isDebited": 1,
            "customerName": "",
            "comments": ""
        },
        {
            "orderId": "85831093-7692-11ef-8277-02d8461243e9",
            "merchantOrderId": "85831093-7692-11ef-8277-02d8461243e9",
            "settledCurrency": "USDT",
            "settledAmountRequested": 2,
            "settledAmountDebited": 2,
            "settledAmountSent": 2,
            "commission": 0,
            "network": "BSC",
            "toAddress": "0xd2AF4B117EfE474B66Fc79E6A8E1938D41a60F4c",
            "status": "Completed",
            "insufficientBalance": 0,
            "paymentURL": "",
            "callBackURL": "",
            "transactions": [
                {
                    "amount": 2,
                    "createdAt": "2024-09-19 14:24:47.000000",
                    "updatedAt": "2024-09-19 14:25:36.000000",
                    "fromAddress": "0x1B3ec402Df254a66B97DE199541295AF2e0F5baA",
                    "transactionHash": "0xb8a583a821234484a6811215d1ecc8b16e5bf35bc01699f8676d646db3b74a5b",
                    "confirmationStatus": 1
                }
            ],
            "createdAt": "2024-09-19T14:21:54Z",
            "expiresAt": "2024-09-19T14:21:54Z",
            "updatedAt": "2024-09-19T14:25:36Z",
            "isFinal": 1,
            "isDebited": 1,
            "customerName": "",
            "comments": ""
        }
    ],
    "errorCode": 0,
    "msg": ""
}
```

{% endtab %}

{% tab title="Response Fields" %}

| **Field Name**           | **Type** | **Description**                                                                   |
| ------------------------ | -------- | --------------------------------------------------------------------------------- |
| `orderId`                | String   | The order ID generated by TL Pay, used as a global identifier.                    |
| `merchantOrderId`        | String   | The merchant's local order ID for reference (optional).                           |
| `settledCurrency`        | String   | The cryptocurrency or token used for payout.                                      |
| `settledAmountRequested` | Number   | The amount of cryptocurrency or token requested to be paid out.                   |
| `settledAmountDebited`   | Number   | The amount of cryptocurrency debited from your merchant balance.                  |
| `settledAmountSent`      | Number   | The total amount of cryptocurrency sent to the recipient.                         |
| `commission`             | Number   | The commission deducted from the payout transaction.                              |
| `network`                | String   | The blockchain network over which the payout is made (e.g., "BSC").               |
| `toAddress`              | String   | The recipient's wallet address where the payout will be sent.                     |
| `status`                 | String   | The status of the payout (e.g., "Pending", "Completed", "Failed").                |
| `insufficientBalance`    | Number   | Indicates if there is insufficient balance for the transaction (1 = Yes, 0 = No). |
| `paymentURL`             | String   | The URL where the customer can make the payment (if applicable).                  |
| `callBackURL`            | String   | The callback URL specified by the merchant (optional).                            |
| `transactions`           | Array    | Details of any individual transactions linked to this payout (if applicable).     |
| `createdAt`              | String   | The timestamp when the payout request was created.                                |
| `expiresAt`              | String   | The timestamp when the payout request will expire.                                |
| `updatedAt`              | String   | The timestamp when the payout request was last updated.                           |
| `isFinal`                | Number   | Indicates if the transaction is final (`1` for completed, `0` for pending).       |
| `isDebited`              | Number   | Indicates if the payout amount has been debited from your merchant account.       |
| `customerName`           | String   | The name of the customer associated with the transaction (optional).              |
| `comments`               | String   | Any comments or notes provided by the merchant (optional).                        |
| {% endtab %}             |          |                                                                                   |
| {% endtabs %}            |          |                                                                                   |
