# API Check Transaction

## <mark style="color:green;">`POST`</mark>

```
https://<vietqr-host>/<basepath>/api/ecommerce-transactions/check-order
```

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

<table data-full-width="false"><thead><tr><th width="187">Name</th><th width="92">Type</th><th width="98">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>bankAccount</code></td><td>String</td><td>Yes</td><td>Số tài khoản ngân hàng.</td></tr><tr><td><code>type</code></td><td>String</td><td>Yes</td><td>Check by <code>orderId</code>: 0<br>Check by <code>referenceNumber</code>: 1</td></tr><tr><td><code>value</code></td><td>String</td><td>Yes</td><td>Giá trị là<code>orderId</code> nếu <code>type</code> = 0<br>Giá trị là<code>referenceNumber</code> nếu <code>type</code> = 1</td></tr><tr><td><code>checkSum</code></td><td>String</td><td>Yes</td><td><p>Chuỗi mã hóa MD5 của tổ hợp:</p><p>(<code>bankAccount</code> + <code>username</code>)</p></td></tr></tbody></table>

**Response**

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

```json
[
    {
        "referenceNumber": "mã_giao_dịch",
        "orderId": "mã_đơn_hàng",
        "amount": số_tiền_giao_dịch,
        "content": "nội_dung_thanh_toán",
        "transType": "giao_dịch_đến_hoặc_đi",
        "status": phân_loại_trạng_thái_giao_dịch_theo_số,
        "type": phân_loại_giao_dịch_theo_số,
        "timeCreated": tem_thời_gian_tạo_mã_QR,
        "timePaid": tem_thời_gian_thanh_toán,
        "terminalCode": "mã_điểm_bán",
        "note": "ghi_chú_giao_dịch",
        "refundCount": số_lần_đã_hoàn_tiền_thuộc_giao_dịch_này,
        "amountRefunded": số_tiền_đã_hoàn_tiền_thuộc_giao_dịch_này
    }
]
```

{% hint style="info" %}
Giá trị trả về của `type`:

* 0: Giao dịch từ hệ thống VietQR.
* 2: Giao dịch ngoài hệ thống VietQR.
* 6: Giao dịch hoàn tiền.
  {% endhint %}

{% hint style="info" %}
Giá trị trả về của `status`:

* 0: Giao dịch chờ thanh toán.
* 1: Giao dịch đã thanh toán.
* 2: Giao dịch hết hạn thanh toán.
  {% endhint %}
  {% endtab %}

{% tab title="400" %}

```json
{
    "status": "FAILED",
    "message": "mã_lỗi_và_mô_tả_lỗi"
}
```

{% endtab %}
{% endtabs %}
