前置作業/設定字軌號碼狀態

應用場景

營業人(特店)新增字軌後,字軌的預設狀態皆為已審核且未啟用。如欲使用字軌,必須先設定狀態將字軌啟用。
在開立發票之前,必須先將已新增完成的字軌做狀態的設定。

API介接網址

  • 測試環境:https://einvoice-stage.ecpay.com.tw/B2CInvoice/UpdateInvoiceWordStatus
  • 正式環境:https://einvoice.ecpay.com.tw/B2CInvoice/UpdateInvoiceWordStatus

HTTPS傳輸協定

  • Content Type :application/json
  • HTTP Method :POST

特店傳入參數(Json格式)

PlatformID String(10)
特約合作平台商代號

  • 這個參數是專為與綠界簽約的指定平台商所設計,只有在申請開通後才能使用。
  • 如果您是一般廠商,請在介接時將此參數欄位保留為空。
  • 對於平台商,在使用時需要在MerchantID(特店編號)欄位中填入與您已經完成綁定子廠商的MerchantID(特定編號)。
    請注意,只能使用已綁定的子廠商編號,以避免操作失敗。綁定作業請洽所屬業務。

MerchantID String(10)
特店編號 必填

RqHeader Object
傳入資料 必填

Timestamp Number
傳入時間 必填

請將傳輸時間轉換為時間戳(GMT+8),綠界會利用此參數將當下的時間轉為Unix TimeStamp來驗證此次介接的時間區間。

❗ 注意事項

  • 驗證時間區間暫訂為 10 分鐘內有效,若超過此驗證時間則此次訂單將無法建立,參考資料:http://www.epochconverter.com/
  • 合作特店須進行主機「時間校正」,避免主機產生時差,導致API無法正常運作。

Data String
加密資料 必填

此為加密過JSON格式的資料。加密方法說明

特店傳入參數範例(Json格式)

				
					{
    "MerchantID": "2000132",
    "RqHeader": {
        "Timestamp": 1525168923
    },
    "Data": "加密資料"
}

				
			

Data參數說明(Json格式) : 請先將Json字串進行urlencode後再進行AES加密

MerchantID String(10)
特店編號 必填

TrackID String(10)
字軌號碼ID 必填

為新增字軌後取到的TrackID

InvoiceStatus Int
發票字軌狀態 必填

  • 如狀態設定為停用,該字軌區間無法上傳發票
  • 0:停用
    1:暫停
    2:啟用

Data參數範例(Json格式)

				
					{
    "MerchantID": "2000132",
    "TrackID": "1123456",
    "InvoiceStatus": 1
}
				
			

綠界回傳參數格式

  • Content Type :application/json
  • HTTP Method :POST

綠界回傳參數(Json格式)

PlatformID String(10)
特約合作平台商代號

MerchantID String(10)
特店編號 

RpHeader Object
回傳資料 

Timestamp Number
回傳時間

時間戳(GMT+8)

TransCode Int
回傳代碼 

1 代表 API 傳輸資料(MerchantIDRqHeaderData)接收成功,實際的 API 執行結果狀態請參考 RtnCode

TransMsg String(200)
回傳訊息 

Data String
加密資料 

回傳相關資料,此為加密過JSON格式的資料。加密方法說明

綠界回傳參數範例

				
					{
    "MerchantID": "2000132",
    "RpHeader": {
        "Timestamp": 1525169058
    },
    "TransCode": 1,
    "TransMsg": "",
    "Data": "加密資料"
}
				
			

Data參數說明(Json格式) : 請先將Data進行AES解密後再做urldecode

RtnCode Int
回應代碼

1 代表 API 執行成功,其餘代碼均為失敗。

RtnMsg String(200)
回應訊息

Data參數範例

				
					{
  "RtnCode": 1,
  "RtnMsg": "成功"
}
				
			

YAML

提供的 YAML 文件用於定義 API 的配置、結構、操作和基礎設施管理等資訊,方便開發人員理解和使用 API。

				
					openapi: 3.1.0
info:
  title: ECPay Setting Track Number Status API
  version: 1.0.0
servers:
  - url: https://einvoice.ecpay.com.tw
    description: Production Environment
  - url: https://einvoice-stage.ecpay.com.tw
    description: Testing Environment
paths:
  /B2CInvoice/UpdateInvoiceWordStatus:
    post:
      summary: Set Track Number Status
      description: Set the status of the track number after it has been added.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - MerchantID
                - RqHeader
                - Data
              properties:
                PlatformID:
                  type: string
                  description: Platform identifier (optional)
                MerchantID:
                  type: string
                  description: Merchant identifier
                RqHeader:
                  type: object
                  properties:
                    Timestamp:
                      type: number
                      description: Timestamp of the request
                Data:
                  type: string
                  description: Encrypted data in JSON format
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  PlatformID:
                    type: string
                    description: Platform identifier
                  MerchantID:
                    type: string
                    description: Merchant identifier
                  RpHeader:
                    type: object
                    properties:
                      Timestamp:
                        type: number
                        description: Timestamp of the response
                  TransCode:
                    type: integer
                    description: Transmission code
                  TransMsg:
                    type: string
                    description: Transmission message
                  Data:
                    type: string
                    description: Encrypted data in JSON format
        '400':
          description: Invalid request
        '500':
          description: Server error
components:
  schemas:
    requestBody.Data:
      type: object
      properties:
        MerchantID:
          type: string
          description: Merchant identifier
        TrackID:
          type: string
          description: Track number ID
        InvoiceStatus:
          type: integer
          description: Invoice track status
          enum:
            - 0
            - 1
            - 2
    responses.Data:
      type: object
      properties:
        RtnCode:
          type: integer
          description: Response code
        RtnMsg:
          type: string
          description: Response message

				
			

Copyright © Green World FinTech Service Co., Ltd. All rights reserved.

綠界官方網站