revert: QR code is required for Native payment, weixin:// is not a web URL

Native payment code_url uses weixin:// protocol which is a WeChat deep link,
not openable in browsers. QR code is the standard approach - user scans
with WeChat and completes payment within the app.
This commit is contained in:
yumoqing 2026-07-16 11:57:36 +08:00
parent a95c548f84
commit a0bd6fb24f

View File

@ -1,15 +1,15 @@
import urllib.parse
params_kw.amount = float(params_kw.amount)
debug(f'recharge.dspy: {params_kw=}')
try:
code_url = await create_payment(request, params_kw)
# weixin://wxpay/bizpayurl?pr=xxx → https://wx.tenpay.com/f2f?pr=xxx
pay_url = code_url.replace('weixin://wxpay/bizpayurl', 'https://wx.tenpay.com/f2f')
qr_url = 'https://api.qrserver.com/v1/create-qr-code/?size=280x280&data=' + urllib.parse.quote(code_url, safe='')
return {
"widgettype":"NewWindow",
"options":{
"url": pay_url,
"height": "100%",
"width":"100%"
"url": qr_url,
"height": "340",
"width":"340"
}
}
except Exception as e: