unipay/wwwroot/recharge.dspy
yumoqing a0bd6fb24f 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.
2026-07-16 11:57:36 +08:00

23 lines
501 B
Plaintext

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)
qr_url = 'https://api.qrserver.com/v1/create-qr-code/?size=280x280&data=' + urllib.parse.quote(code_url, safe='')
return {
"widgettype":"NewWindow",
"options":{
"url": qr_url,
"height": "340",
"width":"340"
}
}
except Exception as e:
return {
"widgettype":"Text",
"options":{
"width":"100%",
"text":f"{e}"
}
}