# Single Transaction Query

## Request

### Header

| Item        | Mandatory | Data Type   | Sample               | Description                                                                    |
| ----------- | --------- | ----------- | -------------------- | ------------------------------------------------------------------------------ |
| Method      | YES       | String(5)   | 00000                | Fill in 00000 (indefinite payment method)                                      |
| ServiceType | YES       | String(32)  | **SingleOrderQuery** | Selected Scan2Pay Service type                                                 |
| MchId       | YES       | String(32)  | Account0001          | Merchant ID provided by intella                                                |
| TradeKey    | YES       | String(128) | sha256...hash        | Marchant password provided by intella, this password must be encoded by SHA256 |
| CreateTime  | YES       | String(14)  | 20180101120000       | Request time, the format is "yyyyMMddHHmmss"                                   |

### Data

| Item         | Mandatory | Data Type  | Sample      | Description  |
| ------------ | --------- | ---------- | ----------- | ------------ |
| StoreOrderNo | YES       | String(20) | PO180101001 | Order number |

## Response

### Header

| Item         | Data Type | Sample               | Description                                                                                                                      |
| ------------ | --------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| StatusCode   | String(4) | 0000                 | [Transaction Status Code](https://intella2.gitbook.io/scan2pay/~/edit/drafts/-L_RhHH-JdlFCMIfEWGU/appendix/scan2pay-error-codes) |
| StatusDesc   | String    | Success              | Description of transaction status                                                                                                |
| Method       | String(5) | 10100                | Payment method code                                                                                                              |
| ServiceType  | String    | **SingleOrderQuery** | Selected Scan2Pay Service type                                                                                                   |
| MchId        | String    | Acoount0001          | Merchant ID                                                                                                                      |
| ResponseTime | String    | 20180101120000       | Transaction response time, the format is "yyyyMMddHHmmss"                                                                        |

### Data

| Item         | Data Type | Sample              | Description                                                                                                           |
| ------------ | --------- | ------------------- | --------------------------------------------------------------------------------------------------------------------- |
| SysOrderNo   | String    | 2018010110074205610 | System order number                                                                                                   |
| StoreOrderNo | String    | PO180101001         | Store order number                                                                                                    |
| FeeType      | String    | TWD                 | Transaction currency, defaults to TWD                                                                                 |
| DeviceInfo   | String    | skb0001             | Terminal number is fixed as skb0001                                                                                   |
| Body         | String    | Chickenchop         | Product name                                                                                                          |
| OrderStatus  | String    | 1                   | <p>Order status</p><p>(0:In processing</p><p> 1:Transaction Success</p><p> 2:Transaction Failure</p><p> 3:Refund)</p> |
| Detail       | String    | Crispychickenchop   | Order detail                                                                                                          |
| StoreInfo    | String    | 00001               | Store ID                                                                                                              |

## API Example

### Request

```
{
  "Header": {
    "Method": "00000",
    "ServiceType": "SingleOrderQuery",
    "MchId": "myMchId",
    "TradeKey": "9af15b336e6a9619928537df30b2e6a2376569fcf9d7e773eccede65606529a0",
    "CreateTime": "20180715102627"
  },
  "Data": "{\"StoreOrderNo\":\"PO-20180715-001\"}"
}
```

### Response

```
{
  "Header": {
    "StatusCode": "0000",
    "StatusDesc": "執行成功",
    "Method": "11500",
    "ServiceType": "SingleOrderQuery",
    "MchId": "myMchId",
    "ResponseTime": "20180715102629"
  },
  "Data": {
    "SysOrderNo": "2018071544571196210",
    "StoreOrderNo": "PO-20180715-001",
    "FeeType": "TWD",
    "Body": "Chicken Rice-6485",
    "OrderStatus": "1"
  }
}
```
