使用流程說明
特店系統可使用此API來設定電子發票通知開關
應用場景
適用於設定電子發票通知開關設定內容
API介接網址
- 測試環境:https://einvoice-stage.ecpay.com.tw/B2CInvoice/InvoiceNotifySetting
- 正式環境:https://einvoice.ecpay.com.tw/B2CInvoice/InvoiceNotifySetting
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)
特店編號 必填
CostomerSetting Array[Object]
發送通知給消費者 必填
NotifyType String(1)
通知類別 必填
1:開立, 2:作廢, 3:折讓, 4:折讓作廢, 5:註銷, 6:中獎
NotifySwitch String(1)
通知方式開關設定 必填
0:關閉
1:僅以Email通知
2:僅以簡訊通知
3:優先以Email通知 (無Email者自動改以簡訊通知)
4:優先以簡訊通知 (無手機號碼者自動改以Email通知)
5:Email及簡訊皆通知
SelfSetting Array[Object]
發送通知給自己 必填
NotifyType String(1)
通知類別 必填
1:開立, 2:作廢, 3:折讓, 4:折讓作廢, 5:註銷, 6:中獎, 7:開立失敗, 8:消費者索取紙本
NotifySwitch String(1)
通知方式開關設定 必填
0:關閉, 1:開啟
InvHeaderRemain Int
發票字軌剩餘多少數量提醒 必填
設定發票字軌剩餘多少數量時,要發提醒
※預設為20
RemainWord Int
[InvHeaderRemain]數量的單位 必填
1:%
2:張
※預設為2:張
EmailSetting String(?)
發送通知給自己Email 必填
發送通知給自己的通知Email
※多組email請以半形分號(;)分隔
NotifyEmail String(?)
發送字軌配號剩餘量提醒通知Email 必填
發送字軌配號剩餘量提醒通知Email
※多組email請以半形分號(;)分隔
Data參數範例(Json格式)
{
"MerchantID": "2000132",
"CostomerSetting": [
{
"NotifyType": "1",
"NotifySwitch": "1"
},
{
"NotifyType": "2",
"NotifySwitch": "1"
}
],
"SelfSetting": [
{
"NotifyType": "1",
"NotifySwitch": "1"
},
{
"NotifyType": "2",
"NotifySwitch": "1"
}
],
"InvHeaderRemain": 20,
"RemainWord": 2,
"EmailSetting": "aa@aa.aa;bb@bb.bb",
"NotifyEmail": "aa@aa.aa;bb@bb.bb",
}
綠界回傳參數格式
- Content Type :application/json
- HTTP Method :POST
綠界回傳參數(Json格式)
PlatformID String(10)
特約合作平台商代號
MerchantID String(10)
特店編號
RpHeader Object
回傳資料
Timestamp Number
回傳時間
Unix timestamp(GMT+8)
TransCode Int
回傳代碼
1 代表 API 傳輸資料(MerchantID, RqHeader, Data)接收成功,實際的 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": "Success"
}
YAML
提供的 YAML 文件用於定義 API 的配置、結構、操作和基礎設施管理等資訊,方便開發人員理解和使用 API。
openapi: 3.1.0
info:
title: 發送通知/取得發票通知方式設定
version: 1.0.0
x-source-url: https://developers.ecpay.com.tw/64067/
servers:
- url: https://einvoice-stage.ecpay.com.tw
description: Testing Environment
- url: https://einvoice.ecpay.com.tw
description: Production Environment
paths:
/B2CInvoice/InvoiceNotifySetting:
post:
summary: 發送通知/取得發票通知方式設定
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- MerchantID
- Timestamp
- Data
- MerchantID
- NotifyType
- NotifySwitch
- NotifyType
- NotifySwitch
- InvHeaderRemain
- RemainWord
properties:
PlatformID:
type: string
maxLength: 10
description: 特約合作平台商代號
MerchantID:
type: string
maxLength: 10
description: 特店編號
Timestamp:
type: number
description: 傳入時間
Data:
type: string
description: 加密資料
NotifyType:
type: string
maxLength: 1
description: 通知類別
NotifySwitch:
type: string
maxLength: 1
description: 通知方式開關設定
InvHeaderRemain:
type: integer
description: 發票字軌剩餘多少數量提醒
RemainWord:
type: integer
description: '[InvHeaderRemain]數量的單位'
RtnCode:
type: integer
description: 回應代碼
RtnMsg:
type: string
maxLength: 200
description: 回應訊息
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
PlatformID:
type: string
maxLength: 10
description: 特約合作平台商代號
MerchantID:
type: string
maxLength: 10
description: 特店編號
Timestamp:
type: number
description: 回傳時間
TransCode:
type: integer
description: 回傳代碼
TransMsg:
type: string
maxLength: 200
description: 回傳訊息
Data:
type: string
description: 加密資料
'400':
description: Invalid request
'500':
description: Server error