使用SquareRegisterSDK-iOS时,我收到user_id_mismatch
错误代码。
我首先在初始视图控制器中设置客户端ID:
override func viewDidLoad() {
super.viewDidLoad()
SCCAPIRequest.setClientID(<my application id>)
view.backgroundColor = UIColor(red: 18 / 255, green: 63 / 255, blue: 87 / 255, alpha: 1.0)
pinInput.attributedPlaceholder = NSAttributedString(string: "pin", attributes: [NSForegroundColorAttributeName: UIColor(white: 1.0, alpha: 0.25)])
}
然后在另一个视图控制器中发出请求:
@IBAction func purchase(_ sender: Any) {
let amount: SCCMoney
do {
amount = try SCCMoney(amountCents: 2300, currencyCode: Constants.currencyCodeString)
} catch let error as NSError {
print("Error creating SCCMoney: \(error)")
return
}
let request: SCCAPIRequest
do {
request = try SCCAPIRequest(
callbackURL: URL(string:"myproject://payment-complete")!,
amount: amount,
userInfoString: nil,
merchantID: <my merchant id>,
notes: nil,
customerID: nil,
supportedTenderTypes: .all,
clearsDefaultFees: false,
returnAutomaticallyAfterPayment: true)
do {
try SCCAPIConnection.perform(request)
} catch let error as NSError {
print("Cannot perform request: \(error)")
return
}
} catch let error as NSError {
print("Error SCCApiRequest: \(error)")
}
}
我不确定它正在寻找什么用户ID,除非我错过了某个地方的文档
答案 0 :(得分:0)
所以我似乎误解了商家ID是什么,我把它与从https://connect.squareup.com/v1/me
返回的方形商家ID混为一谈。
在nil
修复我的错误
SCCAPIRequest