0

微信支付操作中的签名等都是在后台做的,安卓端是可以正常支付,但是 iOS 端一直在微信提示:“appid 未关联paysignkey”

返回的 Response errCode=-2 errStr=nil type=0

WXApi.registerApp("wxxxxxxxxxxxx1")

let request = PayReq()
request.partnerId = "14xxxxxxx2";
request.prepayId = String(describing: dict["prepay_id"]);
request.package = "Sign=WXPay";
request.nonceStr = dict["nonce_str"] as! String;
let time:Int = Int(dict["timestamp"] as! String)!
let time32 = UInt32(truncatingBitPattern: time)
request.timeStamp = time32
request.sign = dict["sign"] as! String;
return request

2个回答

0

已采纳

是这行代码错误:

request.prepayId = String(describing: dict["prepay_id"]);

转字符串不能这么转。。

1

签名出错了, 用官方的调试工具对比一下.
微信支付接口调试工具

撰写答案