gpt4 book ai didi

ios - 我遇到 TAP 付款问题

转载 作者:行者123 更新时间:2023-11-29 05:17:36 25 4
gpt4 key购买 nike

我在我的 swift 代码中集成了点击付款方式,但它不起作用,如果我错过了什么,请指导

这是我的代码

**AppDelegate didFinishLaunchingWithOptions **

    let secretKey = SecretKey(sandbox: "my key", production: "my key")
GoSellSDK.secretKey = secretKey

点击按钮后没有任何反应,不显示点击付款 View Controller View Controller

let session = Session()
session.dataSource = self
session.delegate = self


@IBAction func btnCheckout(_ sender: UIButton) {

SVProgressHUD.show()
session.start()

}

session 委托(delegate)方法

    //TAP Payment

internal func paymentSucceed(_ charge: Charge, on session: SessionProtocol) {

// payment succeed, saving the customer for reuse.

if (charge.receiptSettings?.identifier) != nil {

print(charge.transactionDetails.authorizationID!)
print(charge.receiptSettings!.identifier!)


}
}

internal func paymentFailed(with charge: Charge?, error: TapSDKError?, on session: SessionProtocol) {


print("Error :: ",error?.localizedDescription)

}

internal func authorizationSucceed(_ authorize: Authorize, on session: SessionProtocol) {

// authorization succeed, saving the customer for reuse.

if let customerID = authorize.customer.identifier {



}
}
func authorizationFailed(with authorize: Authorize?, error: TapSDKError?, on session: SessionProtocol)

{
SVProgressHUD.dismiss()
print("Error authorizationFailed:: ",error?.localizedDescription)

}


func sessionIsStarting(_ session: SessionProtocol)
{

print("sessionIsStarting")

}


func sessionHasStarted(_ session: SessionProtocol)
{
print("sessionHasStarted")

}

func sessionHasFailedToStart(_ session: SessionProtocol)
{
print("sessionHasFailedToStart")
SVProgressHUD.dismiss()

}

func sessionCancelled(_ session: SessionProtocol)
{
print("sessionCancelled")
SVProgressHUD.dismiss()
}

session 数据源

//标记:-SessionDataSource

extension PaymentMethodsVC: SessionDataSource {


var currency: Currency? {

return .with(isoCode: "KWD")
}


var amount: Decimal {

let amount = 5.99

return Decimal(amount)
}

var mode: TransactionMode {

return .purchase
}

var customer: Customer? {

// if customerIDIsKnown {
//
// return self.identifiedCustomer
// }
// else {

return self.newCustomer
// }
}

/// Creating a customer with raw information.
var newCustomer: Customer? {

let emailAddress = try! EmailAddress(emailAddressString: "customer@mail.com")
let phoneNumber = try! PhoneNumber(isdNumber: "965", phoneNumber: "96512345")

return try? Customer(emailAddress: emailAddress,
phoneNumber: phoneNumber,
firstName: "Steve",
middleName: nil,
lastName: "Jobs")
}


var postURL: URL? {

return URL(string: "https://tap.company/post")
}

var paymentDescription: String? {

return "Awesome payment description will be here.";
}

}

最佳答案

如果你想在沙盒环境中测试,请在 **AppDelegate didFinishLaunchingWithOptions ** 中添加此内容 **

let secretKey = SecretKey(sandbox: "my key", production: "my key")
GoSellSDK.secretKey = secretKey
GoSellSDK.mode = .sandbox

关于ios - 我遇到 TAP 付款问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59016099/

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