# Sign on

{% hint style="warning" %}
Before executing the functions on EasyCard reader, sign-on is required and it’s only valid for 30 hours. Please sign on again after 30 hours.
{% endhint %}

## Request

### Header

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

### Data

| Item     | Mandatory | Data Type | Sample   | Description              |
| -------- | --------- | --------- | -------- | ------------------------ |
| DeviceId | YES       | String    | 01301234 | Terminal (reader) number |
| Retry    | YES       | String    | 0        | Retry times, fill in 0   |

## 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) | 31800          | Payment method code (EasyCard payment is 31800)                                                                                  |
| ServiceType  | String    | **SignOn**     | Selected Scan2Pay Service type                                                                                                   |
| MchId        | String    | Account0001    | Merchant ID                                                                                                                      |
| ResponseTime | String    | 20180101120000 | Transaction response time, the format is “yyyyMMddHHmmss”                                                                        |

### Data

| Item           | Data Type | Sample           | Description                                                                                                                      |
| -------------- | --------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| DeviceID       | String    | 0220131325       |                                                                                                                                  |
| NewDeviceID    | String    | 0830000001304104 |                                                                                                                                  |
| **TXNResult**  | String    | Success          | Transaction result                                                                                                               |
| Retry          | String    | 0                |                                                                                                                                  |
| ErrorCode      | String    | 000000           | [Transaction Status Code](https://intella2.gitbook.io/scan2pay/~/edit/drafts/-L_RhHH-JdlFCMIfEWGU/appendix/scan2pay-error-codes) |
| DongleDeviceID | String    | 08100DE0A57E     |                                                                                                                                  |
| NewAESKey      | String    | 2406cbf...e9672  |                                                                                                                                  |

## API Example

### Request

```
{
  "Header": {
    "Method": "31800",
    "ServiceType": "SignOn",
    "MchId": "ACCOUNT001",
    "TradeKey": "9af15b3.....606529a0",
    "CreateTime": "20170830192040"
  },
  "Data": "{\"DeviceId\":\"12341234\",\"Retry\":\"0\"}"
}
```

### Response

```
{
  "Header": {
    "StatusCode": "0000",
    "StatusDesc": "STATUS_SUCCESS",
    "Method": "31800",
    "ServiceType": "SignOn",
    "MchId": "S2PT00391",
    "ResponseTime": "20170830192043"
  },
  "Data": {
    "DeviceID": "0220131329",
    "NewDeviceID": "0830000012341234",
    "TXNResult": "Success",
    "Retry": "0",
    "ErrorCode": "000000",
    "DongleDeviceID": "0C100DE0A57E",
    "NewAESKey": "2fb7....4786"
  }
}
```
