使用 Telr 的支付集成

Payment Integration Using Telr

我目前正在研究 Telr Gateway。我已经下载了Swift 4.2版本的Telr SDK,查看了示例测试。

我的问题是:我应该发送 XML 请求还是直接发送样本中提到的请求?

  1. TelrSDK.framework 拖放到框架组中。
  2. 然后转到项目的目标并在嵌入式框架和链接框架中添加 Telr 框架。
  3. 现在清理并构建项目。

示例付款请求。

导入TelrSDK 框架。然后创建支付请求对象,并将请求赋值给telrController的paymentRequest属性。然后按下或呈现 telr 视图控制器。输入卡片详细信息后,您将在视图控制器中获得响应,其中 StoryboardID 称为 ResultController,它继承了 TelrResponseController.

private func openTelrPaymentGateway() {
    paymentRequest = preparePaymentRequest()
    let telrVC = storyboard?.instantiateViewController(withIdentifier: "TelrController") as! TelrController
    telrVC.title = "Telr"
    telrVC.paymentRequest = paymentRequest!
    navigationController?.pushViewController(telrVC, animated: true)
}

private func preparePaymentRequest() -> PaymentRequest{

    let paymentReq = PaymentRequest()
    paymentReq.key = "YOUR KEY"
    paymentReq.store = "YOUR STORE ID"
    paymentReq.appId = "123456789"
    paymentReq.appName = "YOUR APP NAME"
    paymentReq.appUser = "123456"
    paymentReq.appVersion = "0.0.1"
    paymentReq.transTest = "1"
    paymentReq.transType = "auth"
    paymentReq.transClass = "paypage"
    paymentReq.transCartid = String(arc4random())
    paymentReq.transDesc = "Test API"
    paymentReq.transCurrency = "AED"
    paymentReq.transAmount = "\(totalAmount)"
    paymentReq.transLanguage = "en"
    paymentReq.billingEmail = EMAIL
    paymentReq.billingFName = "Hany"
    paymentReq.billingLName = "Sakr"
    paymentReq.billingTitle = "Mr"
    paymentReq.city = "Dubai"
    paymentReq.country = "AE"
    paymentReq.region = "Dubai"
    paymentReq.address = "line 1"
    paymentReq.billingPhone="8785643"
    return paymentReq

}

处理请求后,您将收到来自 TelrResponseController class 的响应。

class PaymentGatewayVC: TelrResponseController {

    override func viewDidLoad() {
    super.viewDidLoad()

      print(message!)
      print(trace!)
      print(status!)
      print(avs!)
      print(code!)
      print(ca_valid!)
      print(cardCode!)
      print(cardLast4!)
      print(cvv!)
      print(tranRef!)

    }

}

希望对您有所帮助。