Documentation
¶
Index ¶
- Constants
- Variables
- type ATMResult
- type BankType
- type ConvenienceStoreBarcodeResult
- type ConvenienceStoreResult
- type CreditResult
- type CrossBorder
- type InstFlag
- type ItemType
- type LangType
- type LgsType
- type Logistics
- type MPGRequest
- type Merchant
- type OrderDetail
- type RespondType
- type Result
- type ReturnDate
- type ReturnDateTradeInfo
- type StoreType
- type TradeInfo
Constants ¶
View Source
const ( DateOnly = "20060102" TimeOnly = "150405" DateTime = "20060102150405" Version = "2.2" )
View Source
const ( BankEsun = "Esun" // 玉山銀行 BankTaishin = "Taishin" // 台新銀行 BankCTBC = "CTBC" // 中國信託銀行 BankNCCC = "NCCC" // 聯合信用卡中心 BankCathayBK = "CathayBK" // 國泰世華銀行 BankCitibank = "Citibank" // 花旗銀行 BankUBOT = "UBOT" // 聯邦銀行 BankSKBank = "SKBank" // 新光銀行 BankFubon = "Fubon" // 富邦銀行 BankFirstBank = "FirstBank" // 第一銀行 BankLINEBank = "LINEBank" // 連線商業銀行 BankSinoPac = "SinoPac" // 永豐銀行 BankBOT = "BOT" // 台灣銀行 BankHNCB = "HNCB" // 華南銀行 )
銀行代碼
View Source
const ( PaymentMethodCREDIT = "CREDIT" // 台灣發卡機構核發之信用卡 PaymentMethodFOREIGN = "FOREIGN" // 國外發卡機構核發之卡 PaymentMethodUNIONPAY = "UNIONPAY" // 銀聯卡 PaymentMethodAPPLEPAY = "APPLEPAY" // ApplePay PaymentMethodGOOGLEPAY = "GOOGLEPAY" // GooglePay PaymentMethodSAMSUNGPAY = "SAMSUNGPAY" // SamsungPay PaymentMethodDCC = "DCC" // 動態貨幣轉換 )
交易類別
View Source
const ( StoreTypeSEVEN = 1 // 統一超商 StoreTypeFAMILY = 2 // 全家便利商店 StoreTypeOK = 3 // OK便利商店 StoreTypeHILIFE = 4 // 萊爾富便利商店 )
繳費門市類別
View Source
const ( PayStoreSEVEN = "SEVEN" // 統一超商 PayStoreFAMILY = "FAMILY" // 全家便利商店 PayStoreOK = "OK" // OK便利商店 PayStoreHILIFE = "HILIFE" // 萊爾富便利商店 )
繳費超商
View Source
const ( ChannelIDALIPAY = "ALIPAY" // 支付寶 ChannelIDWECHATPAY = "WECHATPAY" // 微信支付 ChannelIDACCLINK = "ACCLINK" // 約定連結帳戶 ChannelIDCREDIT = "CREDIT" // 信用卡 ChannelIDCVS = "CVS" // 超商代碼 ChannelIDP2GEACC = "P2GEACC" // 簡單付電子帳戶轉帳 ChannelIDVACC = "VACC" // ATM轉帳 ChannelIDWEBATM = "WEBATM" // WebATM轉帳 )
跨境通路類型
View Source
const ( CryptoCurrencyBTC = "BTC" // 比特幣 BTC CryptoCurrencyETH = "ETH" // 以太幣 ETH CryptoCurrencyUSDT = "USDT" // 泰達幣 USDT )
加密貨幣代號
View Source
const ( PaymentTypeESUNWALLET = "ESUNWALLET" // 玉山 Wallet PaymentTypeLINEPAY = "LINEPAY" // Line Pay PaymentTypeTAIWANPAY = "TAIWANPAY" // 台灣 Pay PaymentTypeEZPAY = "EZPAY" // ezPay 電子錢包 PaymentTypeEZPALIPAY = "EZPALIPAY" // Alipay 支付寶 PaymentTypeEZPWECHAT = "EZPWECHAT" // WeChat 微信 )
付款方式
Variables ¶
View Source
var ( ErrOrderDetailItemNameEmpty = errors.New("ItemName is empty") ErrOrderDetailItemAmtEmpty = errors.New("ItemAmt is empty") ErrOrderDetailItemTypeEmpty = errors.New("ItemType is empty") ErrOrderDetailItemOrderNoEmpty = errors.New("ItemOrderNo is empty") ErrOrderDetailItemOrderTypeExist = errors.New("ItemType is not exist") ErrMPGAesEncryption = errors.New("aes encryption error") ErrTradeShaCheckFail = errors.New("trade sha check error fail") )
Functions ¶
This section is empty.
Types ¶
type ATMResult ¶
type ATMResult struct {
// PayBankCode 付款人金融機構代碼
PayBankCode string `json:"PayBankCode"`
// PayerAccount5Code 付款人金融機構帳號末五碼
PayerAccount5Code string `json:"PayerAccount5Code"`
}
ATMResult WEBATM、ATM繳費回傳參數
type ConvenienceStoreBarcodeResult ¶
type ConvenienceStoreBarcodeResult struct {
// Barcode1 第一段條碼 繳費條碼第一段條碼資料。
Barcode1 string `json:"Barcode_1"`
// Barcode2 第二段條碼 繳費條碼第二段條碼資料。
Barcode2 string `json:"Barcode_2"`
// Barcode3 第三段條碼 繳費條碼第三段條碼資料。
Barcode3 string `json:"Barcode_3"`
// RepayTimes 付款次數 條碼繳費付款次數
RepayTimes int `json:"RepayTimes"`
// PayStore 繳費超商 付款人至超商繳費,該收款超商的代碼,
PayStore string `json:"PayStore"`
}
ConvenienceStoreBarcodeResult 超商條碼繳費回傳參數
type ConvenienceStoreResult ¶
type ConvenienceStoreResult struct {
// CodeNo 繳費代碼 String(30) 繳費代碼。
CodeNo string `json:"CodeNo"`
// StoreType 繳費門市類別 Int(1)
StoreType StoreType `json:"StoreType"`
// StoreID 繳費門市代號 String(10) 繳費門市代號 (全家回傳門市中文名稱)
StoreID string `json:"StoreID"`
}
ConvenienceStoreResult 超商代碼繳費回傳參數
type CreditResult ¶
type CreditResult struct {
// AuthBank 收單金融機構
AuthBank string `json:"AuthBank"`
// CardBank 發卡金融機構
CardBank string `json:"CardBank"`
// RespondCode 金融機構回應碼
RespondCode string `json:"RespondCode"`
// Auth 授權碼
Auth string `json:"Auth"`
// Card6No 卡號前六碼
Card6No string `json:"Card6No"`
// Card4No 卡號末四碼
Card4No string `json:"Card4No"`
// Inst 分期-期別 信用卡分期交易期別。
Inst int `json:"Inst"`
// InstFirst 分期-首期金額 信用卡分期交易首期金額。
InstFirst int `json:"InstFirst"`
// InstEach 分期-每期金額 信用卡分期交易每期金額。
InstEach int `json:"InstEach"`
// ECI
ECI string `json:"ECI"`
// TokenUseStatus 信用卡快速結帳使用狀態
TokenUseStatus int
// RedAmt 紅利折抵後實際金額
RedAmt int `json:"RedAmt"`
// PaymentMethod 交易類別
PaymentMethod string `json:"PaymentMethod"`
// DCCAmt 外幣金額
DCCAmt float64 `json:"DCC_Amt"`
// DCCRate 匯率
DCCRate float64 `json:"DCC_Rate"`
// DCCMarkup 風險匯率
DCCMarkup float64 `json:"DCC_Markup"`
// DCCCurrency 幣別
DCCCurrency string `json:"DCC_Currency"`
// DCCCurrencyCode 幣別代碼
DCCCurrencyCode int `json:"DCC_Currency_Code"`
}
CreditResult 信用卡支付回傳參數
一次付清、分期、紅利、DCC、Apple Pay、Google Pay、Samaung Pay、國民旅遊卡、銀聯、AE
type CrossBorder ¶
type CrossBorder struct {
// ChannelID 跨境通路類型
ChannelID string `json:"ChannelID"`
// ChannelNo 跨境通路 交易序號
ChannelNo string `json:"ChannelNo"`
}
CrossBorder 超商條碼繳費回傳參數
type Logistics ¶
type Logistics struct {
// StoreCode 超商門市編號
StoreCode string
// StoreName 超商門市名稱
StoreName string
// StoreType 超商類別名稱
StoreType string
// StoreAddr 超商門市地址
StoreAddr string
// TradeType 取件交易方式
TradeType int
// CVSCOMName 取貨人
CVSCOMName string
// CVSCOMPhone 取貨人手機號碼
CVSCOMPhone string
// LgsNo 物流寄件單號
LgsNo string
// LgsType 物流型態
LgsType string
}
Logistics 超商物流回傳參數(尚未啟用)
type MPGRequest ¶
type Merchant ¶
type Merchant struct {
// contains filtered or unexported fields
}
func (*Merchant) NewMPGRequest ¶
func (m *Merchant) NewMPGRequest(info TradeInfo) (*MPGRequest, error)
func (*Merchant) ParseReturnData ¶
func (m *Merchant) ParseReturnData(data []byte) (*ReturnDate, error)
type OrderDetail ¶
type RespondType ¶
type RespondType string
const ( RespondTypeJSON RespondType = "JSON" RespondTypeString RespondType = "String" )
type Result ¶
type Result struct {
// MerchantID 商店代號
MerchantID string `json:"MerchantID"`
// Amt 交易金額
Amt int `json:"Amt"`
// TradeNo 藍新金流交易序號
TradeNo string `json:"TradeNo"`
// MerchantOrderNo 商店訂單編號 商店自訂訂單編號
MerchantOrderNo string `json:"MerchantOrderNo"`
// PaymentType
PaymentType string `json:"PaymentType"`
// RespondType
RespondType string `json:"RespondType"`
// PayTime 支付完成時間
PayTime string `json:"PayTime"`
// IP 付款人取號或交易時的IP
IP string `json:"IP"`
// EscrowBank 款項保管銀行
EscrowBank string `json:"EscrowBank"`
// Exp
Exp string `json:"Exp"`
/*信用卡支付回傳參數(一次付清、分期、紅利、DCC、Apple Pay、Google Pay、Samaung Pay、國民旅遊卡、銀聯、AE)*/
// AuthBank 收單金融機構
AuthBank string `json:"AuthBank"`
// CardBank 發卡金融機構
CardBank string `json:"CardBank"`
// RespondCode 金融機構回應碼
RespondCode string `json:"RespondCode"`
// Auth 授權碼
Auth string `json:"Auth"`
// Card6No 卡號前六碼
Card6No string `json:"Card6No"`
// Card4No 卡號末四碼
Card4No string `json:"Card4No"`
// Inst 分期-期別 信用卡分期交易期別。
Inst int `json:"Inst"`
// InstFirst 分期-首期金額 信用卡分期交易首期金額。
InstFirst int `json:"InstFirst"`
// InstEach 分期-每期金額 信用卡分期交易每期金額。
InstEach int `json:"InstEach"`
// ECI
ECI string `json:"ECI"`
// TokenUseStatus 信用卡快速結帳使用狀態
TokenUseStatus int `json:"TokenUseStatus"`
// RedAmt 紅利折抵後實際金額
RedAmt int `json:"RedAmt"`
// PaymentMethod 交易類別
PaymentMethod string `json:"PaymentMethod"`
// DCCAmt 外幣金額
DCCAmt float64 `json:"DCC_Amt"`
// DCCRate 匯率
DCCRate float64 `json:"DCC_Rate"`
// DCCMarkup 風險匯率
DCCMarkup float64 `json:"DCC_Markup"`
// DCCCurrency 幣別
DCCCurrency string `json:"DCC_Currency"`
// DCCCurrencyCode 幣別代碼
DCCCurrencyCode int `json:"DCC_Currency_Code"`
// PayBankCode 付款人金融機構代碼
PayBankCode string `json:"PayBankCode"`
// PayerAccount5Code 付款人金融機構帳號末五碼
PayerAccount5Code string `json:"PayerAccount5Code"`
// CodeNo 繳費代碼 String(30) 繳費代碼。
CodeNo string `json:"CodeNo"`
// StoreType 繳費門市類別 Int(1)
StoreType StoreType `json:"StoreType"`
// StoreID 繳費門市代號 String(10) 繳費門市代號 (全家回傳門市中文名稱)
StoreID string `json:"StoreID"`
// Barcode1 第一段條碼 繳費條碼第一段條碼資料。
Barcode1 string `json:"Barcode_1"`
// Barcode2 第二段條碼 繳費條碼第二段條碼資料。
Barcode2 string `json:"Barcode_2"`
// Barcode3 第三段條碼 繳費條碼第三段條碼資料。
Barcode3 string `json:"Barcode_3"`
// RepayTimes 付款次數 條碼繳費付款次數
RepayTimes int `json:"RepayTimes"`
// PayStore 繳費超商 付款人至超商繳費,該收款超商的代碼,
PayStore string `json:"PayStore"`
// ChannelID 跨境通路類型
ChannelID string `json:"ChannelID"`
// ChannelNo 跨境通路 交易序號
ChannelNo string `json:"ChannelNo"`
// RedDisAmt 紅利折抵金額
RedDisAmt int `json:"RedDisAmt"`
// CryptoCurrency 加密貨幣代號
CryptoCurrency string `json:"CryptoCurrency"`
// CryptoAmount 加密貨幣數量
CryptoAmount string `json:"CryptoAmount"`
// CryptoRate 加密貨幣匯率
CryptoRate string `json:"CryptoRate"`
// PayAmt 實際付款金額
PayAmt int `json:"PayAmt"`
}
func (*Result) ConvenienceStoreBarcodeResult ¶
func (r *Result) ConvenienceStoreBarcodeResult() ConvenienceStoreBarcodeResult
func (*Result) ConvenienceStoreResult ¶
func (r *Result) ConvenienceStoreResult() ConvenienceStoreResult
func (*Result) CreditResult ¶
func (r *Result) CreditResult() CreditResult
func (*Result) CrossBorder ¶
func (r *Result) CrossBorder() CrossBorder
type ReturnDate ¶
type ReturnDate struct {
// Status 回傳狀態
Status string
// MerchantID 回傳訊息
MerchantID string
// TradeInfo 交易資訊 AES 加密
TradeInfo string
// TradeSha 交易資料 SHA256 加密
TradeSha string
// Version 串接程式版本
Version string
// EncryptType 加密模式
EncryptType string
}
func (*ReturnDate) GetTradeInfo ¶
func (r *ReturnDate) GetTradeInfo(m *Merchant) (*ReturnDateTradeInfo, error)
type ReturnDateTradeInfo ¶
type TradeInfo ¶
type TradeInfo struct {
// RespondType 回傳格式 String(6)
RespondType RespondType `validate:"required,response_type" json:"RespondType,omitempty"`
// TimeStamp 時間戳記 String(50)
// 須確實帶入自 Unix 紀元到當前時間的秒數 以避免交易失敗。(容許誤差值 120 秒)
TimeStamp time.Time `validate:"required" json:"TimeStamp"`
// LangType 語系 String(5)
// 英文版 = en
// 繁體中文版 = zh-tw
// 日文版 = jp
LangType LangType `validate:"lang_type" json:"LangType,omitempty"`
// MerchantOrderNo 商店訂單編號 String(30)
MerchantOrderNo string `validate:"required" json:"MerchantOrderNo"`
// Amt 訂單金額 Int(10)
Amt uint `validate:"required" json:"Amt"`
// ItemDesc 商品資訊 String(50)
ItemDesc string `validate:"required" json:"ItemDesc"`
// TradeLimit 交易有效時間 Int(3)
// 秒數下限為 60 秒,小於 60 秒以 60 秒計算
// 秒數上限為 900 秒,大於 900 秒以 900 秒計算
TradeLimit int `json:"TradeLimit,omitempty"`
// ExpireDate 繳費有效期限 String(10)
// 僅適用於非即時支付 格式為 20060102(ebpay.DateOnly)
ExpireDate time.Time `json:"ExpireDate,omitempty"`
// ExpireTime 繳費截止時間 String(6)
// 僅適用於超商代碼繳費 格式為 150405
ExpireTime string `json:"ExpireTime,omitempty"`
// ReturnURL 支付完成 返回商店網址 String(200)
// 交易完成後,以 Form Post 方式導回商店頁面
// 只接受 80 與 443 Port
ReturnURL string `json:"ReturnURL,omitempty"`
// NotifyURL 支付通知網址 String(200)
// webhook 網址
// 只接受 80 與 443 Port
NotifyURL string `json:"NotifyURL,omitempty"`
// CustomerURL 商店取號網址 String(200)
CustomerURL string `json:"CustomerURL,omitempty"`
// ClientBackURL 返回商店網址 String(200)
// 此參數若為空值時,則無返回鈕
ClientBackURL string `json:"ClientBackURL,omitempty"`
// Email 付款人電子信箱 String(50)
Email string `json:"Email,omitempty"`
// EmailModify 付款人電子信箱 是否開放修改 Int(1)
EmailModify bool `json:"EmailModify,omitempty"`
// OrderComment 商店備註 String(300)
OrderComment string `json:"OrderComment,omitempty"`
// CREDIT 信用卡 一次付清啟用 Int(1)
CREDIT bool `json:"CREDIT,omitempty"`
// APPLEPAY Apple Pay 啟用 Int(1)
APPLEPAY bool `json:"APPLEPAY,omitempty"`
// ANDROIDPAY Google Pay 啟用 Int(1)
ANDROIDPAY bool `json:"ANDROIDPAY,omitempty"`
// SAMSUNGPAY Samsung Pay 啟用 Int(1)
SAMSUNGPAY bool `json:"SAMSUNGPAY,omitempty"`
// LINEPAY LINE Pay 啟用 Int(1)
LINEPAY bool `json:"LINEPAY,omitempty"`
// ImageUrl LINE Pay 產品圖檔連結網址 String(200)
ImageUrl string `json:"ImageUrl,omitempty"`
// InstFlag 信用卡 分期付款啟用 String(18)
// 此欄位值=1 時,即代表開啟所有分期期別,且不可帶入其他期別參數
// 此欄位值=0或無值時,即代表不開啟分期
// 接受參數 3 6 8 12 18 24 30
// 多參數使用 "," 拼接
InstFlag []InstFlag `json:"InstFlag,omitempty"`
// CreditRed 信用卡 紅利啟用 Int(1)
CreditRed bool `json:"CreditRed,omitempty"`
// UNIONPAY 信用卡 銀聯卡啟用 Int(1)
UNIONPAY bool `json:"UNIONPAY,omitempty"`
// CREDITAE 信用卡 美國運通卡啟用 Int(1)
CREDITAE bool `json:"CREDITAE,omitempty"`
// WEBATM WEBATM 啟用 Int(1)
WEBATM bool `json:"WEBATM,omitempty"`
// VACC ATM 轉帳啟用 Int(1)
VACC bool `json:"VACC,omitempty"`
// BankType 金融機構 String(26)
// BOT=台灣銀行
// HNCB=華南銀行
// 若未帶值,則預設值為支援所有指定銀行
// 多參數使用 "," 拼接
BankType []BankType `json:"BankType,omitempty"`
// CVS 超商代碼繳費 啟用 Int(1)
CVS bool `json:"CVS,omitempty"`
// BARCODE 超商條碼繳費 啟用 Int(1)
BARCODE bool `json:"BARCODE,omitempty"`
// ESUNWALLET 玉山 Wallet Int(1)
ESUNWALLET bool `json:"ESUNWALLET,omitempty"`
// TAIWANPAY 台灣 Pay Int(1)
TAIWANPAY bool `json:"TAIWANPAY,omitempty"`
// BITOPAY BitoPay Int(1)
BITOPAY bool `json:"BITOPAY,omitempty"`
// CVSCOM 物流啟用 Int(1)
CVSCOM bool `json:"CVSCOM,omitempty"`
// EZPAY 簡單付電子錢包 Int(1)
EZPAY bool `json:"EZPAY,omitempty"`
// EZPWECHAT 簡單付微信支付 Int(1)
EZPWECHAT bool `json:"EZPWECHAT,omitempty"`
// EZPALIPAY 簡單付支付寶
EZPALIPAY bool `json:"EZPALIPAY,omitempty"`
// LgsType 物流型態 String(3)
// B2C=大宗寄倉(目前僅支援 7-ELEVEN)
// C2C=店到店(支援 7-ELEVEN、全家、萊爾富、OK mart)
LgsType LgsType `json:"LgsType,omitempty"`
// OrderDetail 訂單細項 array
OrderDetail []OrderDetail `json:"OrderDetail,omitempty"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.