Merge pull request #54 from machka-pasla/codex/use-fiat-asset-instead-of-crypto-asset
Support fiat invoices in Crypto Pay
This commit is contained in:
+2
-1
@@ -34,7 +34,8 @@ YOOKASSA_PAYMENT_SUBJECT=payment
|
|||||||
# CryptoBot Payment Gateway Configuration
|
# CryptoBot Payment Gateway Configuration
|
||||||
CRYPTOPAY_TOKEN=
|
CRYPTOPAY_TOKEN=
|
||||||
CRYPTOPAY_NETWORK=mainnet
|
CRYPTOPAY_NETWORK=mainnet
|
||||||
CRYPTOPAY_ASSET=TON
|
CRYPTOPAY_CURRENCY_TYPE=fiat
|
||||||
|
CRYPTOPAY_ASSET=RUB
|
||||||
# API key for verifying Tribute webhook signatures
|
# API key for verifying Tribute webhook signatures
|
||||||
TRIBUTE_API_KEY=
|
TRIBUTE_API_KEY=
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ This Telegram bot is designed to automate the sale and management of subscriptio
|
|||||||
* **Subscription Management:**
|
* **Subscription Management:**
|
||||||
* Handles subscription purchases for various periods (1, 3, 6, 12 months).
|
* Handles subscription purchases for various periods (1, 3, 6, 12 months).
|
||||||
* Integrates with **YooKassa** for payment processing, including fiscal receipt data.
|
* Integrates with **YooKassa** for payment processing, including fiscal receipt data.
|
||||||
* Supports **Crypto Pay** for cryptocurrency payments.
|
* Supports **Crypto Pay** for payments with fiat currency (RUB by default).
|
||||||
* Automatic subscription activation/extension upon successful payment.
|
* Automatic subscription activation/extension upon successful payment.
|
||||||
* Link and syncs users with a **Remnawave panel** account, primarily matching by Telegram ID.
|
* Link and syncs users with a **Remnawave panel** account, primarily matching by Telegram ID.
|
||||||
* Updates user status, expiration dates, traffic limits, and inbounds on the Remnawave panel.
|
* Updates user status, expiration dates, traffic limits, and inbounds on the Remnawave panel.
|
||||||
@@ -95,7 +95,7 @@ This Telegram bot is designed to automate the sale and management of subscriptio
|
|||||||
* `YOOKASSA_VAT_CODE`: VAT code for items in receipt (e.g., `1` for "No VAT". Consult YooKassa documentation and tax advisor).
|
* `YOOKASSA_VAT_CODE`: VAT code for items in receipt (e.g., `1` for "No VAT". Consult YooKassa documentation and tax advisor).
|
||||||
* `YOOKASSA_PAYMENT_MODE`: e.g., `full_prepayment`.
|
* `YOOKASSA_PAYMENT_MODE`: e.g., `full_prepayment`.
|
||||||
* `YOOKASSA_PAYMENT_SUBJECT`: e.g., `service`.
|
* `YOOKASSA_PAYMENT_SUBJECT`: e.g., `service`.
|
||||||
* **Crypto Pay Settings:** `CRYPTOPAY_TOKEN`, `CRYPTOPAY_NETWORK` (`mainnet` or `testnet`), `CRYPTOPAY_ASSET` (e.g., `TON`). Enable with `CRYPTOPAY_ENABLED`.
|
* **Crypto Pay Settings:** `CRYPTOPAY_TOKEN`, `CRYPTOPAY_NETWORK` (`mainnet` or `testnet`), `CRYPTOPAY_CURRENCY_TYPE` (`fiat` or `crypto`), `CRYPTOPAY_ASSET` (e.g., `RUB`). Enable with `CRYPTOPAY_ENABLED`.
|
||||||
* **Payment Method Toggles:** `YOOKASSA_ENABLED`, `STARS_ENABLED`, `TRIBUTE_ENABLED`, `CRYPTOPAY_ENABLED`.
|
* **Payment Method Toggles:** `YOOKASSA_ENABLED`, `STARS_ENABLED`, `TRIBUTE_ENABLED`, `CRYPTOPAY_ENABLED`.
|
||||||
* **Subscription Options:** For each duration you can use variables like
|
* **Subscription Options:** For each duration you can use variables like
|
||||||
`1_MONTH_ENABLED`, `RUB_PRICE_1_MONTH`, `STARS_PRICE_1_MONTH`, `TRIBUTE_LINK_1_MONTH`
|
`1_MONTH_ENABLED`, `RUB_PRICE_1_MONTH`, `STARS_PRICE_1_MONTH`, `TRIBUTE_LINK_1_MONTH`
|
||||||
|
|||||||
@@ -78,7 +78,9 @@ class CryptoPayService:
|
|||||||
try:
|
try:
|
||||||
invoice = await self.client.create_invoice(
|
invoice = await self.client.create_invoice(
|
||||||
amount=amount,
|
amount=amount,
|
||||||
asset=self.settings.CRYPTOPAY_ASSET,
|
currency_type=self.settings.CRYPTOPAY_CURRENCY_TYPE,
|
||||||
|
fiat=self.settings.CRYPTOPAY_ASSET if self.settings.CRYPTOPAY_CURRENCY_TYPE == "fiat" else None,
|
||||||
|
asset=self.settings.CRYPTOPAY_ASSET if self.settings.CRYPTOPAY_CURRENCY_TYPE == "crypto" else None,
|
||||||
description=description,
|
description=description,
|
||||||
payload=payload,
|
payload=payload,
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-1
@@ -37,7 +37,8 @@ class Settings(BaseSettings):
|
|||||||
|
|
||||||
CRYPTOPAY_TOKEN: Optional[str] = None
|
CRYPTOPAY_TOKEN: Optional[str] = None
|
||||||
CRYPTOPAY_NETWORK: str = Field(default="mainnet")
|
CRYPTOPAY_NETWORK: str = Field(default="mainnet")
|
||||||
CRYPTOPAY_ASSET: str = Field(default="TON")
|
CRYPTOPAY_CURRENCY_TYPE: str = Field(default="fiat")
|
||||||
|
CRYPTOPAY_ASSET: str = Field(default="RUB")
|
||||||
CRYPTOPAY_ENABLED: bool = Field(default=True)
|
CRYPTOPAY_ENABLED: bool = Field(default=True)
|
||||||
|
|
||||||
YOOKASSA_ENABLED: bool = Field(default=True)
|
YOOKASSA_ENABLED: bool = Field(default=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user