From 70b618a94b45ab62ae45f56ea0cb90c6be75da18 Mon Sep 17 00:00:00 2001 From: 3252a8 <3252a8@proton.me> Date: Mon, 27 Apr 2026 14:38:09 +0300 Subject: [PATCH] feat: use web page for cryptopay in web app --- bot/app/web/subscription_webapp.py | 1 + bot/services/crypto_pay_service.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/bot/app/web/subscription_webapp.py b/bot/app/web/subscription_webapp.py index 3f8145b..c02d34e 100644 --- a/bot/app/web/subscription_webapp.py +++ b/bot/app/web/subscription_webapp.py @@ -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") diff --git a/bot/services/crypto_pay_service.py b/bot/services/crypto_pay_service.py index 6051a17..a0dfcb3 100644 --- a/bot/services/crypto_pay_service.py +++ b/bot/services/crypto_pay_service.py @@ -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.")