From ef1078279a0cc03ee2f88afdd932858d555fbb00 Mon Sep 17 00:00:00 2001 From: erio Date: Fri, 6 Mar 2026 22:32:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BE=AE=E4=BF=A1=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=9A=82=E6=97=B6=E7=BB=9F=E4=B8=80=E4=BD=BF=E7=94=A8=20Native?= =?UTF-8?q?=20=E6=89=AB=E7=A0=81=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit H5 支付需要在微信商户平台单独开通权限,当前未开通会报 NO_AUTH 错误。暂时移动端也走 Native 二维码,待 H5 权限 开通后再恢复。 Co-Authored-By: Claude Opus 4.6 --- src/lib/wxpay/provider.ts | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/lib/wxpay/provider.ts b/src/lib/wxpay/provider.ts index 82decfb..55240d8 100644 --- a/src/lib/wxpay/provider.ts +++ b/src/lib/wxpay/provider.ts @@ -35,20 +35,22 @@ export class WxpayProvider implements PaymentProvider { throw new Error('WXPAY_NOTIFY_URL is required'); } - if (request.isMobile) { - if (!request.clientIp) { - throw new Error('clientIp is required for H5 payment'); - } - const h5Url = await createH5Order({ - out_trade_no: request.orderId, - description: request.subject, - notify_url: notifyUrl, - amount: request.amount, - payer_client_ip: request.clientIp, - }); - return { tradeNo: request.orderId, payUrl: h5Url }; - } + // TODO: H5 支付需要在微信商户平台开通权限,开通后取消注释 + // if (request.isMobile) { + // if (!request.clientIp) { + // throw new Error('clientIp is required for H5 payment'); + // } + // const h5Url = await createH5Order({ + // out_trade_no: request.orderId, + // description: request.subject, + // notify_url: notifyUrl, + // amount: request.amount, + // payer_client_ip: request.clientIp, + // }); + // return { tradeNo: request.orderId, payUrl: h5Url }; + // } + // 统一使用 Native 扫码模式(PC + 移动端) const codeUrl = await createPcOrder({ out_trade_no: request.orderId, description: request.subject,