gpt4 book ai didi

ios - 使用 Telr 进行支付集成

转载 作者:行者123 更新时间:2023-12-01 16:07:37 24 4
gpt4 key购买 nike

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

我的问题是:我应该发送 XML 请求还是直接发送,就像示例中提到的那样?

最佳答案

  • TelrSDK.framework 拖放到 Frameworks 组中。
  • 然后去你项目的Target,在Embedded frameworks和Linked frameworks中添加Telr framework。
  • 现在清理并构建项目。

  • sample 付款请求。

    导入 TelrSDK 框架。然后创建一个支付请求对象并将请求分配给 telrController 的 paymentRequest 属性。然后推送或呈现 telr View Controller 。输入卡片详细信息后,您将在 View Controller 中获得名为 ResultController 的 StoryboardID 的响应,它继承了 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 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!)

    }

    }

    希望这对您有所帮助。

    关于ios - 使用 Telr 进行支付集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54481980/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com