微信支付报错: The `certs(***)` contains the merchant‘s certificate serial number(***) which is not allowe

The certs(***) contains the merchant’s certificate serial number(***) which is not allowed here.
这个报错,就是用错了 证书

是你不恰当地把商户证书序列号,填在了平台证书序列号位置,SDK替你做了判断,你这种配置方法错了。
举个例子,都是钥匙,你家的钥匙和我家的钥匙,都是钥匙,但是你不能拿你家的来开我家的门,这就是非对称加解密技术的概要。

read.me中有段话:

你需要先手工 下载平台证书 才能使用 SDK 发起请求。

怎么下载,这里我用了 composer 安装,使用下面命令

composer exec CertificateDownloader.php -- -k ${apiV3key} -m ${mchId} -f ${mchPrivateKeyFilePath} -s ${mchSerialNo} -o ${outputFilePath}

参数说明:
-m, --mchid=<merchantId>   商户号
-s, --serialno=<serialNo>  商户证书的序列号
-f, --privatekey=<privateKeyFilePath>
                           商户的私钥文件
-k, --key=<apiV3key>       ApiV3Key
-o, --output=[outputFilePath]
                           下载成功后保存证书的路径,可选参数,默认为临时文件目录夹
-u, --baseuri=[baseUri]    接入点,默认为 https://api.mch.weixin.qq.com/
-V, --version              Print version information and exit.
-h, --help                 Show this help message and exit.

直接喂你嘴里,我的命令为:

root@98f93f1bd4aa:/var/www/html/extension# pwd
/var/www/html/extension
root@98f93f1bd4aa:/var/www/html/extension# composer exec CertificateDownloader.php -- -k 10SopwGN**K2h2A8GQ -m 167**903 -f /var/www/html/extension/extend/wechatpay/cert2/apiclient_key.pem -s 6060E85**18086180 -o ./

此时会生成一个文件在当前目录下,拷贝到你想要的目录下
支付代码修改为:

$platformCertificateFilePath = file_get_contents(EXTEND_PATH.'wechatpay/cert2/wechatpay_11C0A82***75725AD1E.pem');
$platformPublicKeyInstance = Rsa::from($platformCertificateFilePath, Rsa::KEY_TYPE_PUBLIC);

结束

参考链接

https://github.com/wechatpay-apiv3/wechatpay-php/issues/26
https://github.com/wechatpay-apiv3/wechatpay-php#%E5%A6%82%E4%BD%95%E4%B8%8B%E8%BD%BD%E5%B9%B3%E5%8F%B0%E8%AF%81%E4%B9%A6
https://github.com/wechatpay-apiv3/wechatpay-php/blob/main/bin/README.md
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
回答: 当你在编译过程中遇到"make: *** 没有规则可制作目标“%.cpp”"的错误时,这通常是由于Makefile文件中的规则不正确导致的。请确保你的Makefile文件中包含了正确的规则来编译你的源代码文件。根据你提供的引用\[3\]中的代码,你可以尝试将以下内容添加到你的Makefile文件中: ``` %.o: %.cpp $(CXX) $(CXXFLAGS) -c $< -o $@ ``` 这个规则告诉make命令如何将.cpp文件编译成.o文件。请确保你将`$(CXX)`和`$(CXXFLAGS)`替换为适合你的编译环境的编译器和编译选项。另外,请确保你的Makefile文件中还包含了正确的目标和依赖关系规则,以确保所有的源文件都能正确地编译和链接。 #### 引用[.reference_title] - *1* [Linux内核编译错误:make[1]: *** 没有规则可制作目标“debian/canonical-certs.pem”,由“certs/x509_certificate_list” 需求。 停止](https://blog.csdn.net/m0_51203305/article/details/120805372)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [make[2]:***没有规则制作目标XXX,由XXX需求。停止。](https://blog.csdn.net/willhu2008/article/details/122026117)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [make[2]: *** 没有规则可制作目标“/home/.../src/viewer.cpp”,需求。 停止... recipe for target ‘.....‘failed问题解决](https://blog.csdn.net/qq_52852944/article/details/121809638)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值