Square Connect SDK打开一个空白页面



>我正在尝试实现Square Connect iOS SDK,在实施并单击付款按钮后,它会打开Square Payment 应用程序并重定向到空白页.. 你们有同样的问题吗?

"我的应用"委托具有正确的部分:

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
guard let sourceApplication = options[.sourceApplication] as? String,
sourceApplication.hasPrefix("com.squareup.square") else {
return false
}
do {
let response = try SCCAPIResponse(responseURL: url)
if let error = response.error {
// Handle a failed request.
print(error.localizedDescription)
} else {
// Handle a successful request.
}
} catch let error as NSError {
// Handle unexpected errors.
print(error.localizedDescription)
}
return true
}

我已经在Square门户内创建了一个适当的URL方案。我的视图控制器也有正确的代码:

func charge()
{
// connect v1
if let callbackURL = URL(string: "myscheme://")
{
do
{
SCCAPIRequest.setClientID("xxxxxxxxxxx")
let amount = try SCCMoney(amountCents: 100, currencyCode: "USD")
let request = try SCCAPIRequest(
callbackURL: callbackURL,
amount: amount,
userInfoString: nil,
locationID: nil,
notes: "Purchase for cleaning",
customerID: nil, supportedTenderTypes: .all,
clearsDefaultFees: true,
returnAutomaticallyAfterPayment: true)
try SCCAPIConnection.perform(request)
}
catch let error as NSError {
print(error.localizedDescription)
}
}
}

https://snag.gy/R4A30L.jpg

安德烈

您需要确保从手机中删除具有重复捆绑ID的所有应用程序。这样,您将确保返回到触发付款的原始应用程序。

最新更新