// 1、拿到服务端生成的字符串
let dataString = json["data"].stringValue
// 2、拼接成一个json
let json: [String: Any] = ["fromAppUrlScheme":"ap11111111","requestType":"SafePay","dataString":dataString]
// 3、拼接完后,对整个json进行 url encode
let encodeString = json.jsonString()?.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
// 4、最前面加上:alipay://alipayclient/?
let url = URL(string: "alipay://alipayclient/?(encodeString ?? "")")
let order = MonkeyKing.Order.alipay(url: url!)
MonkeyKing.deliver(order) { (result) in
MonkeyKing 对于后台返回了签名字符串进行支付宝支付没有进行相关的文档,只是在【请问支持现在支付宝最新的APP支付吗?】这个问题的回复中找到了相关步骤说明,已成功调起支付,在此贡献一下粗略的代码,给后面集成支付宝支付的朋友节省点时间
// 1、拿到服务端生成的字符串 let dataString = json["data"].stringValue
// 2、拼接成一个json let json: [String: Any] = ["fromAppUrlScheme":"ap11111111","requestType":"SafePay","dataString":dataString]
// 3、拼接完后,对整个json进行 url encode let encodeString = json.jsonString()?.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
// 4、最前面加上:alipay://alipayclient/? let url = URL(string: "alipay://alipayclient/?(encodeString ?? "")") let order = MonkeyKing.Order.alipay(url: url!) MonkeyKing.deliver(order) { (result) in
}