# Status Checking

Payout Status is an API link to get the status of previous transaction. all payout status are in here.

{% hint style="info" %} <mark style="color:blue;">Please ensure that the correct ID is provided to prevent any errors in the API response.</mark>
{% endhint %}

## Authentication

LeanX uses **Auth Token** to authenticate in each request's header.

{% hint style="info" %}
**Auth Token** can be retrieved in your portal dashboard under **API** page.
{% endhint %}

**Request Header**

{% code overflow="wrap" %}

```json
{
    "auth-token": "LP-0D7C06DE-MM|7394e58e-edee-4c42-9ca5-bcbc449f1b9f|2141df4a3cb633d5ce8683bb0c55067e5caebfbe07390dde277dc455bcc95c91723a81b5e565c7c02d68fb84e396722563016bf99e576a4b8cdbe4423fbf226b"
}
```

{% endcode %}

## Getting payout status

HTTP Method: <mark style="color:yellow;">POST</mark>

```
https://api.leanx.dev/api/v1/merchant/get-payout-transaction-by-id
```

#### Request Query

```json
?_id=PAYOUT-A9D5:174307-LEANX
```

```
?_id=INVOICE1234
```

You may choose to search for transaction status based on **payout id** (given by the system) or **external\_invoice\_ref** (given by your side upon create payout request) based on necessity. However, it is advisable to always search based on **external\_invoice\_ref** to ensure that your internal record and payout request is in-sync.&#x20;

#### Attributes

<table><thead><tr><th width="281.3333333333333">Property</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td>_id</td><td>String</td><td><strong>Payout invoice number</strong> that you want to get the status or <strong>external invoice reference</strong> added upon create payout request</td></tr></tbody></table>

#### Response

```json
{
  "response_code": 2000,
  "description": "SUCCESS",
  "app_version": "/api/v1",
  "talk_to_server_before": "2023-12-05T18:02:55.948983",
  "data": {
    "payout_invoice_no": "PAYOUT-A9D5:174307-LEANX",
    "merchant_invoice_id": "VA-F04EC4-164712020277-PAYOUT",
    "id": 419,
    "payout_account_number": "8011408168",
    "transaction_fee": 0.00,
    "account_id": 3,
    "record_status": 1,
    "updated_at": "2023-12-05T17:44:05",
    "switch_invoice_id": "VP1678085468bA52B",
    "transaction_invoice_no": "PAYOUT1701769387uG4ENyls",
    "transaction_status": "SUCCESS",
    "value": 13.00,
    "switch_transaction_fee": 0.00,
    "api_key": "18e0933d-6bc1-4808-9bc7-aad2bcd38686",
    "created_at": "2023-12-05T17:43:07"
  },
  "breakdown_errors": null,
  "token": "18e0933d-6bc1-4808-9bc7-aad2bcd38686"
}
```

## Transaction Statuses

The table below displays the possible statuses that may be provided by the Lean.x platform during execution.

<table><thead><tr><th width="308">Statuses</th><th>Description</th></tr></thead><tbody><tr><td><strong>SUCCESS</strong></td><td>Transaction is successfully executed and money has been transfered to target account.</td></tr><tr><td><strong>PENDING</strong></td><td>Transaction request has been sent to Lean.x platform. Require manual checking.</td></tr><tr><td><strong>STATUS_PENDING_APPROVAL</strong></td><td>Transaction has been sent to Lean.x platform, however due to provider limitation, it will not be transfer instanly. Will require manual approval by Lean.x operation team. Turn around time is 30-40 minutes.</td></tr><tr><td><strong>FAILED</strong></td><td>Transaction is failed to be executed at our platform</td></tr></tbody></table>

{% hint style="info" %}
Due to the nature of Lean.x instant payout, response status of **SUCCESS** or **FAILED** can also be taken as final confirmation.
{% endhint %}

## Detailed Error Message

In order to understand better for each **FAILED** status appear in payout response, Lean.x has included an error message object which can be seen as per example below.

```json
{
  "data": {
   .....
    "error_message": {
      "response_code": 5223,
      "error_code": "77",
      "error_message": "Account Verification Failed. Please Try Again",
      "description": "PAYOUT_FAILED",
      "data": null
    }
   .....
}
```
