mirror of
https://github.com/bohd4nx/FragmentAPI.git
synced 2026-07-25 06:14:29 +00:00
feat: update changelog for new payment methods; add UserNotFoundError handling in purchase flows
This commit is contained in:
@@ -39,7 +39,7 @@ pip install git+https://github.com/bohd4nx/pyfragment.git@dev
|
||||
```python
|
||||
import asyncio
|
||||
from pyfragment import FragmentClient
|
||||
|
||||
from pyfragment.models.enums import PaymentMethod
|
||||
|
||||
async def main() -> None:
|
||||
async with FragmentClient(
|
||||
@@ -57,10 +57,17 @@ async def main() -> None:
|
||||
|
||||
recipient = "https://t.me/username" # also: @username, username
|
||||
|
||||
stars = await client.purchase_stars(recipient, amount=500, payment_method="usdt_ton")
|
||||
print(f"Sent {stars.amount} Stars to {stars.username} | tx: {stars.transaction_id}")
|
||||
stars = await client.purchase_stars(recipient, amount=500, payment_method=PaymentMethod.USDT_TON)
|
||||
if stars.auto_paid:
|
||||
print(f"Sent {stars.amount} Stars to {stars.username} | tx: {stars.transaction_id}")
|
||||
else:
|
||||
print(f"Manual payment required for {stars.username}")
|
||||
print(f"Address: {stars.payment_address}")
|
||||
print(f"Amount: {stars.payment_amount}")
|
||||
print(f"Expires: {stars.payment_expires_at}")
|
||||
print(f"QR link: {stars.payment_qr_link}")
|
||||
|
||||
premium = await client.purchase_premium(recipient, months=6, payment_method="ton")
|
||||
premium = await client.purchase_premium(recipient, months=6, payment_method=PaymentMethod.TON)
|
||||
print(f"Sent Premium {premium.amount}m to {premium.username} | tx: {premium.transaction_id}")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user