diff --git a/app/Services/WeChatPayService.php b/app/Services/WeChatPayService.php index fa382360..865d1d75 100644 --- a/app/Services/WeChatPayService.php +++ b/app/Services/WeChatPayService.php @@ -55,6 +55,10 @@ class WeChatPayService */ public function pay(array $params) { + if (isset($params['notify_url'])) { + $params['notify_url'] = url(route('wxpay.paid_notify', [], false), [], true); + } + // 如果交易类型不存在,则使用 App 支付 if (! isset($params['trade_type'])) { $params['trade_type'] = static::TRADE_TYPE_APP; diff --git a/config/wechat.php b/config/wechat.php index f1206e16..d3303768 100644 --- a/config/wechat.php +++ b/config/wechat.php @@ -9,7 +9,7 @@ return [ 'key' => env('WECHAT_PAYMENT_KEY'), 'cert_path' => env('WECHAT_PAYMENT_CERT_PATH'), // 绝对地址 'key_path' => env('WECHAT_PAYMENT_KEY_PATH'), // 绝对地址 - 'notify_url' => url(route('wxpay.paid_notify', [], false), [], true), + 'notify_url' => env('WECHAT_PAYMENT_NOTIFY_URL'), ], ], ];