feat: use web page for cryptopay in web app

This commit is contained in:
3252a8
2026-04-27 14:38:09 +03:00
parent 0610156f80
commit 70b618a94b
2 changed files with 8 additions and 0 deletions
+1
View File
@@ -2138,6 +2138,7 @@ async def _create_subscription_payment(
amount=price,
description=description,
sale_mode="subscription",
url_kind="web",
)
if not url:
return _json_error(502, "payment_failed", "Failed to create payment")
+7
View File
@@ -70,6 +70,7 @@ class CryptoPayService:
amount: float,
description: str,
sale_mode: str = "subscription",
url_kind: str = "bot",
) -> Optional[str]:
if not self.configured or not self.client:
logging.error("CryptoPayService not configured")
@@ -128,6 +129,12 @@ class CryptoPayService:
payment_record.payment_id,
)
return None
if url_kind == "web":
return (
getattr(invoice, "web_app_invoice_url", None)
or getattr(invoice, "mini_app_invoice_url", None)
or invoice.bot_invoice_url
)
return invoice.bot_invoice_url
except Exception:
logging.exception("CryptoPay invoice creation failed.")