模擬串接服務 - 後付款查詢出貨

經銷商『後付款查詢出貨』請求欄位
Id Name Description Type Additional Information
1 agent_uid 經銷商商務代號
string 必填
2 service 服務名稱
string 必填
{ "service_name": "api", "cmd": "api\/afpshipmentquery" }
JSON格式,AES256加密資料
3 encry_data 『後付款查詢出貨』欄位資料 string 必填
『後付款查詢出貨』欄位參考
JSON格式,AES256加密資料
特約商店『後付款查詢出貨』請求欄位
Id Name Description Type Additional Information
1 store_uid 特約商店商務代號
string 必填
2 service 服務名稱
string 必填
{ "service_name": "api", "cmd": "api\/afpshipmentquery" }
JSON格式,AES256加密資料
3 encry_data 『後付款查詢出貨』欄位資料 string 必填
『後付款查詢出貨』欄位參考
JSON格式,AES256加密資料
後付款查詢出貨』欄位
Id Name Description Type Additional Information
1 store_uid 特約商店代碼 string
2 uid 訂單編號(UID) string
3 key 特約商店驗證碼 string
後付款查詢出貨』回傳欄位
Id Name Description Type Additional Information
1 uid 訂單編號(UID) string
2 key 交易驗証碼 string
3 code 交易狀態碼 string
4 msg 交易狀態訊息 string
5 finishtime 交易完成時間(YYYYMMDDHHmmss) string
6 trade_no 後付款訂單編號 string
7 transaction_mode 交易服務類型 integer 『交易服務類型』值參考
8 supplier_name 交易之金融服務商 string
9 supplier_code 交易之金融服務商代碼 string
10 order_id 貴特店系統的訂單編號 string
11 user_id 消費者帳號 string
12 user_real_name 消費者真實姓名 string
13 user_zipcode 消費者郵遞區號 string
14 user_address 消費者地址 string
15 user_cellphone 消費者行動電話 string
16 user_email 消費者 E-Mail string
17 shipping_info 送貨資訊 object 『後付款送貨資訊』欄位參考
18 shipment_no 出貨編號 string
19 delivery_code 貨運商家編號 integer 『貨運商家編號』值參考
20 cost 總交易金額 string
21 currency 原交易幣別 string
22 actual_cost 實際交易金額 string
23 actual_currency 實際交易幣別 string
24 pfn 付費方法 string
25 refund_order 退款訂單資訊(多筆格式) array 每筆『後付款出貨查詢-退款資訊』欄位參考
26 invoice_state 發票開立狀態 integer 『電子發票開立狀態類型』值參考
27 invoice_date 發票開立日期(YYYYMMDD) string
28 invoice_wordtrack 發票字軌 string
29 invoice_number 發票號碼 string
30 invoice_rand_code 電子發票隨機碼 string
31 invoice_seller_ban 賣方統一編號 string
32 invoice_buyer_ban 買方統一編號 string
33 invoice_left_qrcode 電子發票左邊QrCode內容 string
34 invoice_middle_barcode 電子發票中間Barcode內容(格式Code-39) string
35 invoice_right_qrcode 電子發票右邊QrCode內容 string
36 invoice_title_type 電子發票列印標題格式 integer 『電子發票紙本列印標題類型』值參考
37 invoice_title 電子發票列印標題格式 integer 『電子發票紙本列印標題類型』值參考
38 invoice_print_type 電子發票列印類型 integer 『電子發票列印類型』值參考
39 invoice_print_device 電子發票列印設備 integer 『電子發票列印設備』值參考
40 invoice_amount 電子發票銷售總額 string
41 invoice_sales_amount 電子發票銷售額 string
42 invoice_tax_amount 電子發票稅額 string
43 invoice_order_detail 電子發票全部產品明細(JSON格式) string 『商品細項』值參考
44 invoice_ratetype 電子發票稅率別 integer 『電子發票稅率別』值參考
45 invoice_tax_rate 電子發票稅率:預設0.05(零稅與免稅帶0) float
46 invoice_remark 發票註記(依加值中心提供註記功能) string
47 invoice_input_type 電子發票開立類型 integer 『電子發票開立類型』值參考
48 invoice_cloud_type 電子發票開立類型-雲端發票類型 string 『雲端發票類型』值參考
49 invoice_mobile_code 當invoice_cloud_type為2時紀錄的手機條碼 string
50 invoice_tax_id 當invoice_cloud_type為2時紀錄的統一編號 string
51 invoice_natural_person 當invoice_cloud_type為3時紀錄的自然人憑證條碼 string
52 invoice_m_post_zone 當invoice_cloud_type為4時紀錄中獎時紙本發票郵遞區號 string
53 invoice_m_address 當invoice_cloud_type為4時紀錄中獎時紙本發票收件住址 string
54 invoice_love_code 當invoice_input_type為2時紀錄的愛心碼 string
55 invoice_b2b_title 當invoice_input_type為3時紀錄的發票抬頭 string
56 invoice_b2b_id 當invoice_input_type為3時紀錄的統一編號 string
57 invoice_b2b_post_zone 當invoice_input_type為3時紀錄的郵遞區號 string
58 invoice_b2b_address 當invoice_input_type為3時紀錄的發票地址 string
59 invoice_allowance 電子發票折讓資訊 array 每筆『電子發票折讓資訊』欄位參考
60 echo_0 自訂回傳參數 1 string
61 echo_1 自訂回傳參數 2 string
62 echo_2 自訂回傳參數 3 string
63 echo_3 自訂回傳參數 4 string
64 echo_4 自訂回傳參數 5 string
交易服務類型』 值內容
Value Description Type Additional Information
0 尚未進行閘道交易 integer
1 代收代付 integer
2 特店模式 integer
後付款送貨資訊』欄位
Id Name Description Type Additional Information
1 shipment_type 配送方式 integer 『後付款送貨資訊』值參考
2 company_name 寄送地公司名稱 string
3 department_name 寄送地部門名稱 string
4 name 收貨姓名 string 必填
5 cvs 超商類型(超商店到店必填) integer 『後付款超商取貨』值參考
6 cvs_store 超商店號代碼(超商店到店必填) string
7 cvs_store_name 超商店號名稱(超商店到店必填) string
8 zip_code 收貨郵遞區號(純宅配必填) string
9 ship_address 收貨地址(超商店到店為超商店址) string 必填
10 tel 收貨電話(超商店到店為超商電話) string 必填
貨運商家編號』 值內容
Value Description Type Additional Information
0 無法辨識 integer
1 黑貓宅急便 integer
2 台灣宅配通 integer
3 新竹貨運 integer
4 大榮貨運 integer
5 中華郵政 integer
6 便利帶 integer
7 大智通物流 integer
8 日翊文化行銷 integer
9 EMS integer
10 國際e郵包 integer
11 大和國際宅急便 integer
12 佐川國際宅急便 integer
13 Dmail/Pmail integer
14 ECMS日本 integer
後付款出貨查詢-退款資訊』欄位
Id Name Description Type Additional Information
1 uid 退款訂單編號(UID) string
2 code 交易狀態碼 string
3 msg 交易狀態訊息 string
4 cost 總交易金額 string
5 currency 原交易幣別 string
6 actual_cost 實際交易金額 string
7 actual_currency 實際交易幣別 string
8 finishtime 交易完成時間(YYYYMMDDHHmmss) string
9 invoice_state 發票開立狀態 integer 『電子發票開立狀態類型』值參考
10 invoice_date 發票開立日期(YYYYMMDD) string
11 invoice_wordtrack 發票字軌 string
12 invoice_number 發票號碼 string
13 invoice_rand_code 電子發票隨機碼 string
14 invoice_seller_ban 賣方統一編號 string
15 invoice_buyer_ban 買方統一編號 string
16 invoice_left_qrcode 電子發票左邊QrCode內容 string
17 invoice_middle_barcode 電子發票中間Barcode內容(格式Code-39) string
18 invoice_right_qrcode 電子發票右邊QrCode內容 string
19 invoice_title_type 電子發票列印標題格式 integer 『電子發票紙本列印標題類型』值參考
20 invoice_title 電子發票列印標題內容 string
21 invoice_amount 電子發票銷售總額 string
22 invoice_sales_amount 電子發票銷售額 string
23 invoice_tax_amount 電子發票稅額 string
24 invoice_order_detail 電子發票全部產品明細(JSON格式) string 『商品細項』值參考
25 invoice_ratetype 電子發票稅率別 integer 『電子發票稅率別』值參考
26 invoice_tax_rate 電子發票稅率:預設0.05(零稅與免稅帶0) float
27 invoice_remark 發票註記(依加值中心提供註記功能) string
28 invoice_input_type 電子發票開立類型 integer 『電子發票開立類型』值參考
29 invoice_allowance 電子發票折讓資訊 array 每筆『電子發票折讓資訊』欄位參考
電子發票開立狀態類型』 值內容
Value Description Type Additional Information
0 不處理或已無效(預設) integer
1 等候處理中 integer
2 發票開立成功 integer
3 發票開立失敗(系統或特約商店發票相關設定不正確) integer
4 作癈 integer
5 發票開立失敗(系統發生錯誤) integer
6 折讓 integer
電子發票紙本列印標題類型』 值內容
Value Description Type Additional Information
1 文字 integer
2 圖形(圖片網址) integer
電子發票列印類型』 值內容
Value Description Type Additional Information
0 不列印 自行處置 integer
1 列印 電子發票 + 商品明細 integer
2 只印電子發票 integer
3 只印商品明細 integer
電子發票列印設備』 值內容
Value Description Type Additional Information
0 自行處理 integer
1 SUNMI V2 PRO integer
商品細項』欄位
Id Name Description Type Additional Information
1 Description 商品名稱 string 必填
2 Quantity 數量 string 必填
3 UnitPrice 單價 string 必填
4 Amount 總金額 string 必填
電子發票稅率別』 值內容
Value Description Type Additional Information
1 應稅(預設) integer
2 零稅率 integer
3 免稅 integer
電子發票開立類型』 值內容
Value Description Type Additional Information
0 未使用電子發票開立 integer
1 雲端發票 integer
2 發票捐贈 integer
3 實體發票 integer
雲端發票類型』 值內容
Value Description Type Additional Information
0 未使用雲端發票類型 integer
2 手機條碼 integer
3 自然人憑證條碼 integer
4 以E-Mail寄送 integer
電子發票折讓資訊』欄位
Id Name Description Type Additional Information
1 uid 發生之退款交易流水號(UID) string
2 allowance_no 折讓單號 string
3 amount 電子發票折讓金額 integer
4 order_detail 電子發票折讓明細(JSON格式) string 『商品細項』值參考
後付款送貨資訊』 值內容
Value Description Type Additional Information
2 純宅配 integer
4 超商店到店 integer
後付款超商取貨』 值內容
Value Description Type Additional Information
1 7-11 integer
2 全家 integer
AES256資料加密方式說明

1、所有的API送出HTTPs請求之欄位中,service 和 encry_data 欄位皆進行 AES256+BASE64 加密處理。
2、AES加密,格式為CBC,長度為256bits,金鑰長度32,IV長度16,傳遞內文為加密後組合IV並經過Base64轉換後傳出。

方式:
使用自訂的AES256函式將JSON資料加密後,再將IV資料和此AES256加密後的JSON資料串聯後,使用base64再進行加密成ASCII字串即可完成加密。

    PHP加密示意:
    AesEncrypt -> base64_ecode($IV . $JSON)

    C#加密示意:
    AesEncrypt -> (bytes)IV+(bytes)Json -> toBase64

    Java加密示意:
    AesEncrypt -> (bytes)IV+(bytes)Json -> toBase64

    Node.js加密示意:
    AesEncrypt -> concat([IV,JSON], [IV_SIZE,JSON_SIZE]) -> toString('base64')
    Python加密示意:
    AesEncrypt -> (bytes)IV+(bytes)Json -> base64.b64encode

範例程式碼