取得Apple Pay 延遲付款的付款代碼 ( PayToken )
當使用的是 Apple Pay 延遲付款功能(PaymentUIType = 5),請呼叫此功能取得付款代碼(PayToken),再利用此PayToken,呼叫建立交易API來完成交易。
注意事項:如需使用Apple Pay付款方式,請參考自訂Apple Pay付款功能。使用createPayment()產生畫面,將有上架APP不通過的可能。
ECPayPaymentGatewayManager.sharedInstance().createPayment(token, language, useResultPage, appStoreName)
帶入參數
Token String
廠商驗證碼 必填
初始化站內付2.0畫面代碼,此參數具30分鐘時效性
Language String
多語系 必填
可使用以下方式設定使用語系
- zh-TW : 繁中
- en-US : 英文
UseResultPage Int
是否顯示付款結果 必填
是否由綠界顯示付款結果通知或超商/ATM取號結果通知頁面
- 0:否
- 1:是
AppStoreName String
APP商店名稱 必填
APP商店名稱,顯示於付款畫面的APP商店名稱,特店可自行定義顯示的名稱
callBack接口調用說明
當付款畫面完成後,將callBack付款結果。付款結果內容如下:
callbackStateStatus CallbackStateStatusType
Callback狀態
注意事項:當狀態為Cancel時,建議利用查詢訂單API反查訂單狀態。
callbackStateMessage String
回應訊息
PaymentInfo Object
付款資訊
PayToken String(64)
付款代碼
有效期限為 3天。取得付款代碼後,用法請參考建立交易API
MerchantTradeNo String(20)
特店交易編號
PaymentType String(20)
使用者選擇的付款方式
- ApplePayDeferred:Apple Pay 延遲付款
取得 Apple Pay 延遲付款 PayToken 使用範例
ECPayPaymentGatewayManager.sharedInstance().createPayment(token: token, merchantID: "", useResultPage: use_resultPage_Switch.isOn ? 1 : 0, app"測試的商店(\(ECPayPaymentGatewayManager.sharedInstance().sdkEnvironmentString()))", language: use_enUS_Switch.isOn ? "en-US" : "zh-TW")
{ (state) in
self.resultTextView.text = state.description
if let callbackState = state as? CreatePaymentCallbackState {
print("CreatePaymentCallbackState:")
}
let ac = UIAlertController(title: "提醒您", message: "已經 callback,請看 console!", preferredStyle: UIAlertController.Style.alert)
let aa = UIAlertAction(title: "好", style: UIAlertAction.Style.default, handler: nil)
ac.addAction(aa)
self.present(ac, animated: true, completion: nil)
}