wesmiler hace 13 horas
padre
commit
762cf8ebdc
Se han modificado 2 ficheros con 3 adiciones y 1 borrados
  1. 2 0
      app/Services/PaymentService.php
  2. 1 1
      config/payment.php

+ 2 - 0
app/Services/PaymentService.php

@@ -75,6 +75,7 @@ class PaymentService extends BaseService
                 $mchid = isset($config['wxpay_mchd']) ? $config['wxpay_mchd'] : '';
                 $secretV3Key = isset($config['wxpay_key_v3']) ? $config['wxpay_key_v3'] : '';
                 $secretV2Key = isset($config['wxpay_key_v2']) ? $config['wxpay_key_v2'] : '';
+                $publicKeyId = isset($config['public_key_id']) ? $config['public_key_id'] : '';
                 $wxpaySecretCert = isset($config['wxpay_secret_cert']) ? $config['wxpay_secret_cert'] : '';
                 $wxpayPublicCert = isset($config['wxpay_public_cert']) ? $config['wxpay_public_cert'] : '';
                 if (empty($appid) || empty($mchid) || empty($secretV3Key)) {
@@ -85,6 +86,7 @@ class PaymentService extends BaseService
                 // 支付参数
                 $payConfig = config('payment.wechat');
                 $payConfig['wechat']['default']['mch_id'] = $mchid;
+                $payConfig['wechat']['default']['wechat_public_cert_path']["PUB_KEY_ID_{$publicKeyId}"] = base_path().'/resources/certs/wechat/pub_key.pem';
 
                 if ($payPt == 'min') {
                     // 小程序支付

+ 1 - 1
config/payment.php

@@ -14,7 +14,7 @@ return [
                 // 选填-微信公钥证书路径,公钥方式验证签名需配置
                 'wechat_public_cert_path' => [
                     //前面是证书***,登录商户平台【API安全】->【API证书】->【查看证书】,可查看商户API证书***
-                    'PUB_KEY_ID_0116426419052026020300212051002807' => base_path().'/resources/certs/wechat/pub_key.pem',
+//                    'PUB_KEY_ID_0116426419052026020300212051002807' => base_path().'/resources/certs/wechat/pub_key.pem',
                 ],
                 // 必填
                 'notify_url' => '',