{
"code": 200,
"msg": "success",
"data": {
"timeStamp": "1676551631",
"nonceStr": "6XZG5JD4H1Y79RFQOTI3VEPNSBCAW8MU",
"package": "prepay_id=wx16204711623191ebbca668131cddb30000",
"signType": "RSA",
"paySign": "wEdYtkdvKK+5v1JQDFmAJ5wO6Mb6fEnlglRw75AorkFMiVUILeBitRWFPuj1XfiWblHE25FbB7KohCTQBekVJjAE/CSudq1N2Geo0op1CVIYykF1iRKJjNK2Bi4zYfs7Yeh8B23ijUjsPpDoKkCKbiWCwUunki1+NvRTDjiXyNwCHPMRpHTWkusl3Ee7Y2krAylpcyxI/NwRDuCniuX9HJNMv/KOut6qWMXEonU7rLGUSshMBrYihwbZsxjHRFjpSdohENsQvT73gac3akMTYrjYzpz/1TOoEQTvsCKaQgoG3638Lx36effKawnr6oKS1RDsQB0U8xqhdQ3ke48OOA=="
}
}
prepay_id都获取正常,调起支付的时候,报jsapi缺少参数 total_free的问题。那位大神能给看看
下面是PHP的签名代码。现在不知道是获取prepay_id的问题,还是调起支付签名的问题?
//根据prepay_id,
//微信小程序调起支付的参数和签名
$prepay_id = $wechatPayMsg;
//时间戳
$timeStampMini = time() . "";
//随机串
$nonceStr = Order::rand_code();
$package = "prepay_id=" . $prepay_id;
$miniMessage = $config["miniapp_id"] . chr(10) . $timeStampMini. chr(10) .$nonceStr . chr(10) .$package . chr(10);
openssl_sign($miniMessage, $mini_sign, $private_key, 'sha256WithRSAEncryption');
$sign = base64_encode($mini_sign);
$signType = "RSA";
$data = [
"timeStamp" => $timeStampMini,
"nonceStr" => $nonceStr,
"package" => $package,
"signType" => $signType,
"paySign" => $sign
];
您好,查询到该参数日志没有调起支付记录,大概率是您代码里的prepayid传错了,辛苦您再检查下。
请问解决了吗?怎么解决的求教
之前也遇到过,建议下单之后,先把参数写死在小程序里面调试下。
先检查参数是否正确,如果参数都没问题,检查小程序主体和支付商户主体是否一致,如果主体不一致的话也会出现这个错误;主体不一致需要填写授权书才可以使用的
{ "mchid": "163xxxxs82", "out_trade_no": "L20230217095718000000035278", "appid": "wxbf56ssssc7b337b", "description": "全麦面包黄瓜片梨子麦片健康下午茶搭配设计", "notify_url": "https://shop.letianpai.com/addons/shop/order/epay/type/notify/paytype/wechat", "amount": { "total": 100, "currency": "CNY" }, "payer": { "openid": "opyQ85TvDY0qiwe4uFErMTx_o2FA" } } z这是生成prepay_id的参数,排查了都没有问题
现在请求prepay_id和签名换成了微信官方SDK了。签名应该都没有问题了。但是调起支付还是 jsapi缺少参数 total_free,
$params = [ 'appId' => $config["miniapp_id"], 'timeStamp' => (string)Formatter::timestamp(), 'nonceStr' => Formatter::nonce(), 'package' => 'prepay_id='.$prepay_id, ]; $params += ['paySign' => Rsa::sign( Formatter::joinedByLineFeed(...array_values($params)), $merchantPrivateKeyInstance ), 'signType' => 'RSA'];
参考链接:https://developers.weixin.qq.com/community/develop/doc/000eca8d8143a080bacbecfd351009?_at=1676555520977
这个你要检查统一下单方面的代码。支付金额要整数,必须提交。如果没有提交的话调起微信支付的时候会这样提示。