mirror of
https://github.com/bohd4nx/FragmentAPI.git
synced 2026-07-25 14:24:31 +00:00
1.1 KiB
1.1 KiB
Stars Purchase
Use this method to send Telegram Stars directly to a user.
Method
await client.purchase_stars(
username: str,
amount: int,
show_sender: bool = True,
payment_method: PaymentMethod = PaymentMethod.GRAM,
) -> StarsResult
Parameters
username: accepts@username,username, orhttps://t.me/usernameamount: integer from50to10_000_000show_sender: controls sender visibility on recipient sidepayment_method:PaymentMethod.GRAM(default),PaymentMethod.USDT_GRAM, or any otherPaymentMethodvalue
Amount must be between 50 and 10_000_000.
Return
StarsResult(transaction_id, username, amount)
Typical errors
ConfigurationError: invalid amount or payment methodUserNotFoundError: target user not foundWalletError: insufficient balance or wallet-side issueVerificationError: verification/KYC required for operation
Example
result: StarsResult = await client.purchase_stars("@username", amount=500, payment_method=PaymentMethod.GRAM)
print(result.amount)