---
# System prepended metadata

title: TrirdPartyNotify 規格 v2

---

# TrirdPartyNotify 規格 v2

<br>

---

<br>

## 權限

<br>

需要 __`THIRD_PARTY_ADMIN`__ Role 權限

<br>

取得授權與GASH Gamefi System 溝通驗證之Access Token

URL
		測試環境：https://staging-api.gashpoint.io/oauth/token	
		正式環境：https://api.gashpoint.io/oauth/token
	
__HTTP POST__

header 帶固定的 authorization

```json
{"authorization": "Basic dGhpcmRQYXJ0eTpmd3A4RTJOVkR5dVdTNlczTWZTeWV1ZkZBWHJaU2s1Qg=="
```


```json
{
    "username": string, // Gash申請所提供OAuth帳號
    "password": string, // Gash申請所提供OAuth帳號
    "grant_type": string // 固定用 ‘password’
}
```

__回應__

```json
{
    "access_token": string, // 所核發Token
    "token_type": string, // token類型
    "refresh_token": string, // 刷新token使用
    "expires_in": string, // token使用期限
    "scope": string, // 授權類型
    "jti": string // JWT ID
}
```

<br>
<br>

__call Notify API 時，Header 帶入 token 即可（要加 Bearer）__：


```json
{
    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsiIl0sInVzZXJfbmFtZSI6InBhcGlkYWtvcyIsInNjb3BlIjpbInJlYWQiLCJ3cml0ZSJdLCJleHAiOjE0ODcyMjIxNDMsImF1dGhvcml0aWVzIjpbIlJPTEVfVVNFUiJdLCJqdGkiOiIzMWUzYzdiNi0zY2U4LTQ1YWMtOGU1Mi1lNzU0M2JhZTljMzUiLCJjbGllbnRfaWQiOiJjbGllbnRhcHAifQ.tUCo7NUhMCZDz_CMyr9fsVSqwFoHEvkSOfZHAeMEmn8"
}
```

<br>

---


<br>

## API

<br>

Method: __POST__

__dev__: 

`https://dev-api.gashpoint.io/gamefi/api/payment/v1/thirdPartyChainNotify`

__stage__: 

`https://staging-api.gashpoint.io/gamefi/api/payment/v1/thirdPartyChainNotify`

__prod__: 

`https://api.gashpoint.io/gamefi/api/payment/v1/thirdPartyChainNotify`

<br>

---

<br>

## 請求參數

<br>


* erC20TransferLogList: List<ERC20TransferLog>
    
    <br>

    * ERC20TransferLog: Object

        * contractAddress: String (合約位置)
        
        * chainId: Integer (鍊ID)
        
        * currency: String (交易幣別) 

        * from: String (發送方)

        * to: String (接收方)

        * amount: String （交易金額）

        * fees: String (手續費) 

        * decimal: Integer (位數)
    
        * feesDecimal: Integer (手續費位數)

        * transactionHash: String （txHash）
    
        * tIndex: Integer (its block 的 index)
    
        * voutIndex: Integer (vout 的 index)
    
        * memo: String (memo)

        * createTime: String (交易時間：yyyy-MM-dd HH:mm:ss）

        * additionalInfo: String (Json 字串，附加訊息另說明)
    
        * status: String ("S" 成功，"F" 失敗)

<br>
<br>
    
__additionalInfo 附加訊息說明__：
    
* 若交易失敗，可以把交易失敗原因訊息放到裡面 (ex: "errorMsg": "交易失敗原因")
    
    
* 若有 contract_abi 可以放在裡面 （ex: "contractAbi": "test123"） 

    
<br>    
    
<br>

### DEMO POST

<br>

```json
{
    "erC20TransferLogList": [
        {
            "contractAddress": "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd",
            "chainId": 1,
            "currency": "BNB",
            "from": "0xd86aF8e0c15D58F3bEaBE3BbaDA18a09B92650F5",
            "to": "0x0952CA46762c3C9B1d8d3ac36AAcCf4854ea905e",
            "amount": "20000000000000000",
            "fees": "517820000000000",
            "decimal": 18,
            "feesDecimal": 16,
            "transactionHash": "0xc1a231aaca8f7480cc05d309293fd9bcacc75d935af07a3599526fa12eedfb9c",
            "voutIndex": 1,
            "tIndex": 1,
            "memo": "memo",
            "createTime": "2022-11-11 11:11:11",
            "additionalInfo": "{'feesDecimal': 16}",
            "status": "S"
        },
    
        {
            "contractAddress": "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd",
            "chainId": 1,
            "currency": "BNB",
            "from": "0xd86aF8e0c15D58F3bEaBE3BbaDA18a09B92650F5",
            "to": "0x0952CA46762c3C9B1d8d3ac36AAcCf4854ea905e",
            "amount": "20000000000000000",
            "fees": "517820000000000",
            "decimal": 18,
            "feesDecimal": 16,
            "transactionHash": "0xc1a231aaca8f7480cc05d309293fd9bcacc75d935af07a3599526fa12eedfb9c",
            "voutIndex": 1,
            "tIndex": 1,
            "memo": "memo",
            "createTime": "2022-11-11 11:11:11",
            "additionalInfo": "{'errorMsg': '失敗原因'}",
            "status": "F"
        }
    ],
}

```

<br>

---

<br>

## 回應

<br>

__200 成功__

<br>

```json
{
  "MsgLevel": "SUCCESS", // 訊息等級
  "MsgCode": "000000", // 回應代碼
  "Msg": "OK", // 回應訊息
  "Data": true
}
```


<br>

__4xx or 5xx 失敗__

<br>

```json
{
  "MsgLevel": "SYSTEM_ERROR", // 訊息等級
  "MsgCode": "999999", // 回應代碼
  "Msg": "system exception error", // 回應訊息
  "Data": "失敗具體原因" // 回應額外訊息
}
```

<br>

