feat: 支付宝直连 H5 端使用 wap.pay 唤起支付宝 APP

前端传递 is_mobile 参数,AlipayProvider 根据设备类型选择:
- PC: alipay.trade.page.pay (FAST_INSTANT_TRADE_PAY)
- H5: alipay.trade.wap.pay (QUICK_WAP_WAY)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
erio
2026-03-06 18:04:11 +08:00
parent 94d25ddc31
commit d46793f072
6 changed files with 17 additions and 6 deletions

View File

@@ -22,16 +22,20 @@ export class AlipayProvider implements PaymentProvider {
};
async createPayment(request: CreatePaymentRequest): Promise<CreatePaymentResponse> {
const method = request.isMobile ? 'alipay.trade.wap.pay' : 'alipay.trade.page.pay';
const productCode = request.isMobile ? 'QUICK_WAP_WAY' : 'FAST_INSTANT_TRADE_PAY';
const url = pageExecute(
{
out_trade_no: request.orderId,
product_code: 'FAST_INSTANT_TRADE_PAY',
product_code: productCode,
total_amount: request.amount.toFixed(2),
subject: request.subject,
},
{
notifyUrl: request.notifyUrl,
returnUrl: request.returnUrl,
method,
},
);