下载微信支付公钥 NOTE 2024年Q3,微信支付官方开启了「微信支付公钥」平替「平台证书」方案,初始化所需的参数仅需配置上 微信支付公钥ID 及 微信支付公钥 即完全兼容支持,CLI/API下载 平台证书 已不是一个必要步骤,可略过。 微信支付公钥ID 及 微信支付公钥 均可在 微信支付商户平台 -> 账户中心 -> API安全 查看及/或下载。 see https://wechatpay.im/guide/getting-started#pubkey
第一次下载平台证书 , 返回无可用的平台证书,请在商户平台-API安全申请使用微信支付公钥[图片][图片]
02-28去商户平台/小程序中申诉,或者打95017找客服申诉
微信支付客户一直遇到存在异常,无法支付!这个问题能不能给解决一下呢?我单位在经营中遇到商户存在异常,这个我们也是刚开通不久,为什么一直拦截,也给客服提供了一定的材料,可是回复太慢,现在大环境不好,已经跑好多单了,以为遇到了骗子,我们公司经过工商局审批,也经过各方面实名认证。
02-28建议用 composer require wechatpay/wechatpay 完整示例: https://wechatpay.im/openapi/v3/pay/partner/transactions/jsapi 偶发验签失败,可能原因是 https://wechatpay.im/guide/getting-started#cli: 重要提示 当下载证书后,屏显有几条证书信息,就在应用中配置certs几条,尤其是在新旧平台证书交替灰度时,需要把新旧证书都配上,应用才不会出现事故。
微信支付下单接口,偶发签名错误,不知道什么原因?在调用:https://pay.weixin.qq.com/doc/v3/merchant/4012791856 接口时,偶发会出现微信支付签名验证失败的错误,但是也会响应prepay_id。 这个一般是什么情况呢?因为是偶发,无从下手,最近这几天比较频繁,影响到业务了。 求微信支付的大佬们帮忙诊断一下,非常感谢 🙏 相关代码: // 获取支付JSDK Json public static function payWeChatServerJson($order, $notify_url = '', $detail = '', $appid = '') { $params = Yii::$app->params['wechatServerPaymentConfig']; $merchantId = $params['sp_mchid']; $merchantSerialNumber = $params['merchant_serial_no']; $merchantPrivateKey = PemUtil::loadPrivateKey($params['key_path']); $wechatpayCertificate = PemUtil::loadCertificate($params['wechatpay_certificate']); $wechatpayMiddleware = WechatPayMiddleware::builder() ->withMerchant($merchantId, $merchantSerialNumber, $merchantPrivateKey) ->withWechatPay([$wechatpayCertificate]) ->build(); $stack = \GuzzleHttp\HandlerStack::create(); $stack->push($wechatpayMiddleware, 'wechatpay'); $client= new \GuzzleHttp\Client(['handler' => $stack]); $sp_appid ='wx1956xxxx'; $jsonData = [ "sp_appid" => $sp_appid, 'sp_mchid'=>$params['sp_mchid'], "sub_appid" => $order->appid, "sub_mchid" => $order->mchid, 'description' => $detail ? $detail : '订单说明', 'out_trade_no' => $order->order_no, 'notify_url' => $notify_url, "amount" => [ "total" => $order->fee, "currency" => "CNY" ], "payer" =>[ "sub_openid" => $order->openid, ], ]; try { $resp = $client->request('POST', 'https://api.mch.weixin.qq.com/v3/pay/partner/transactions/jsapi', [ 'json' => $jsonData, 'http_errors' => false, 'headers' => ['Accept' => 'application/json'] ] ); } catch (\GuzzleHttp\Exception\RequestException $e) { // 安全获取响应内容 $responseBody = $e->hasResponse() ? $e->getResponse()->getBody()->getContents() : 'No response content'; // 结构化日志记录 $logData = [ 'request' => $jsonData, 'response' => $responseBody, 'error' => $e->getMessage(), 'trace' => $e->getTraceAsString() ]; // 报警信息优化 $alertMsg = sprintf( "微信支付服务商接口异常\n请求数据:%s\n响应内容:%s\n错误信息:%s", json_encode($jsonData), $responseBody, $e->getMessage() ); ToolFun::sendAlterMsg($alertMsg); ToolFun::FileLog(json_encode($logData, JSON_UNESCAPED_UNICODE), 'v4pay-error.log'); return '网络异常'; } 错误日志: 微信支付服务商接口异常 请求数据:{"sp_appid":"wx9dccec5***","sp_mchid":"1543***","sub_appid":"wx9dcc***","sub_mchid":"1659***","description":"***","out_trade_no":"MJS2502282130238867c0983728149","notify_url":"https://***/xcx/paywechatservercallback","amount":{"total":500,"currency":"CNY"},"payer":{"sub_openid":"ozZkF5hWMB9X3VF0nOvhS45Ds3wY"}} 响应内容:{"prepay_id":"wx2800520749042783303cc29fb09af30000"} 错误信息:应答的微信支付签名验证失败
02-28国内进件接口与global的加密方案不一致,你用的是哪个接口?
平台证书切换微信支付公钥,请求头设置了Wechatpay-Serial商户进件接口报错错误信息:平台证书序列号Wechatpay-Serial错误 下单以及订单回调是没有问题的,但是商户进件就会报错,走的是同一个代码逻辑,唯一有区别的是敏感字加密,但是微信文档里面加密方式跟之前的平台证书一样,所以我并没有修改,目前问题卡住了求助。 这是敏感字加密代码 [图片]
02-26这个接口返回的数据,字段不是标准APIv3加密的,java需要用 RSA/ECB/PKCS1Padding 去解密
敏感数据用商户私钥解密失败[图片] [图片] [图片] https://api.mch.weixin.qq.com/v3/facemch/users 请求实名认证接口返回加密的敏感数据,参考文档https://pay.weixin.qq.com/doc/v3/merchant/4013053265,使用商户API证书私钥apiclient_key.pem解密失败
02-20https://wechatpay.im/guide/digital-signature#asymmetric.frontend 参照这里,大概率是 \n 是软回车符号的问题,是1个字节,你给签名验证工具里的,可能是两个字节
小程序调起支付提示支付签名错误,生成的签名和签名工具中生成的一致,各参数也核对了没有问题,这是为什?[图片][图片]
02-20通过HTTPS访问OSS出现证书异常如何处理?
微信小程序直传阿里云oss,为什么报证书错误?苹果手机上传会报:uploadFile:fail errcode:-207 cronet_error_code:-207 error_msg:net::ERR_CERT_INVALID 华为手机上传会报:uploadFile:fail net::ERR_CERT_AUTHORITY_NVALID
02-18这俩接口是对 https://pay.weixin.qq.com/doc/v3/partner/4012160714 的封装分发,不能说是「实时」拔特也是「99.99%」情形可用。
小程序银行信息接口咨询接口1: 小程序支付管理服务/银行信息接口/获取银行列表 https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/funds/bank/getbanklist.html 接口2:小程序支付管理服务/银行信息接口/获取支行列表 https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/funds/bank/getsubbranch.html 请问上述2个接口是否实时更新,上一次更新是多久?这个接口可否大部分场景查询到最新数据?
02-18按照规范,jsonBody.toString() 是要通过multipart/form-data 里的 meta 字段发给服务端,你这个有没有发呢?
图片上传接口构建签名串计算的签名无法通过签名校验 ,反而不按照文档构建的签名串计算的签名值能通过?POST\n /v3/marketing/favor/media/image-upload\n 1739854234\n aa3ea8f02276438b90a63cfeea0d5c56\n\n 这个签名串计算出的签名值能通过签名校验 POST\n /v3/marketing/favor/media/image-upload\n 1739854337\n b08f3dcc57664f308d76615e17766826\n {"filename":"50d23bdcab1242b68f49e64d41439844.png","sha256":"cfbf7c2a60d18cb397b3ff8155abb04271aea8361feb55ec1a59d76adcdc53b9"}\n 这个按照文档中给的签名串构建计算出的签名通过不了签名校验 [图片] {"code":"SIGN_ERROR","detail":{"detail":{"issue":"sign not match"},"field":"signature","location":"authorization","sign_information":{"method":"POST","sign_message_length":89,"truncated_sign_message":"POST\n/v3/marketing/favor/media/image-upload\n1739854337\nb08f3dcc57664f308d76615e17766826\n\n","url":"/v3/marketing/favor/media/image-upload"}},"message":"错误的签名,验签失败"} //计算文件摘要 String sha256 = DigestUtils.sha256Hex(imageBytes); System.out.println("SHA-256: " + sha256); //构建签名串 String timestamp = String.valueOf(System.currentTimeMillis() / 1000); String nonceStr = UUID.randomUUID().toString().replaceAll("-", ""); Map<String, String> dataMap = new HashMap<>(); dataMap.put("filename", newFileName); dataMap.put("sha256",sha256); ObjectMapper objectMapper = new ObjectMapper(); String jsonBody = objectMapper.writeValueAsString(dataMap); System.out.println("jsonBody:"+jsonBody.toString()); //生成签名串signatureStr String signatureStr = buileSignature("POST",apiurl,timestamp,nonceStr,jsonBody); // String signatureStr = buileSignature("POST",apiurl,timestamp,nonceStr); System.out.println("signatureStr:"+signatureStr); //计算签名值 String sign = createSign(signatureStr); System.out.println("sign:"+sign); //构造Authorization String authorization = String.format("WECHATPAY2-SHA256-RSA2048 mchid=\"%s\",nonce_str=\"%s\",timestamp=\"%s\",serial_no=\"%s\",signature=\"%s\"", mchId, nonceStr, timestamp, certSerialNo, // 证书序列号 sign);
02-18timestamp 按规范是10字节字符串(到秒),你程序 System.currentTimeMillis() 获取的是毫秒,13字节,所以不行啊
02-13