收藏
回答

IOS 支付签名验证失败,安卓可以

下单后端只返回了订单号,调起支付其余参数有前端处理,安卓同样的方法可以支付,但是ios不可以,支付验真失败;

签名工具验证成功;

时间戳,随机数必须与下单相同吗???

// IOS

PayReq *request = [[[PayReq alloc] init] autorelease];

    request.partnerId = @"1488**7822";
    request.prepayId= prepayId;
    request.package = @"Sign=WXPay";
    request.nonceStr= [self randomStringWithLength:32];
    request.timeStamp= [self getNowTime];
     
    NSString* stringA = [NSString stringWithFormat:@"appid=%@&noncestr=%@&package=%@&partnerid=%@&prepayid=%@&timestamp=%d&key=***************", WXPatient_App_ID, request.nonceStr, request.package, request.partnerId, request.prepayId, (unsigned int)request.timeStamp];
     
    request.sign= [self stringToMD5:stringA];
    NSLog(@"%@, sign=%@", stringA,request.sign);

    [WXApi sendReq:request];


appid=wxc3500fb47****157&noncestr=tEnYIqCxFxmDRDt4XVjtsh2iXJX8yybg&package=Sign=WXPay&partnerid=1488**7822&prepayid=wx2216544109200*****abe351432201400&timestamp=1569142481&key=c368c4d*******, sign=71ECBB450047F4C83184FB4F50C1D77D


// JAVA(可行)

PayReq request = new PayReq();

request.appId = APP_ID;

request.partnerId = "1488**7822";

request.prepayId = prepayId;

request.packageValue = "Sign=WXPay";

request.nonceStr = UUID.randomUUID().toString();

request.timeStamp = Long.toString(System.currentTimeMillis() / 1000);

request.sign = sign(request.partnerId, request.prepayId,request.packageValue, request.nonceStr,equest.timeStamp, "c368c4d*********");

wxapi.sendReq(request);




麻烦各位帮忙看一下,谢谢!!!!

最后一次编辑于  2019-09-22
回答关注问题邀请回答
收藏

1 个回答

  • 微信支付技术助手1
    微信支付技术助手1
    2019-09-23

    签名问题和IOS或者android关系不大。只和参数,KEY以及参数编码有关。

    2019-09-23
    有用
    回复 1
    • 苗浩
      苗浩
      2019-12-31
      我是同样的问题!!!!!
      2019-12-31
      回复
登录 后发表内容
问题标签