Skip to main content

fragment-api-dev

PyPI Python License API

The focused Python SDK for buying Telegram Stars and Telegram Premium through Fragment.

  • GRAM and USDT on TON
  • No API key
  • Automatic status polling
  • Zero runtime dependencies

Install

pip install fragment-api-dev

Quick start

import os

from fragment_api import FragmentAPI


api = FragmentAPI()

purchase = api.buy_stars(
    username="@telegram_user",
    amount=50,
    payment_method="gram",
    seed=os.environ["TON_WALLET_SEED"],
)

result = api.wait(purchase.purchase_id)

if result.completed:
    print("Delivered:", result.transaction_hash)
else:
    print("Not completed:", result.status, result.error)

The SDK generates an idempotency key automatically, submits the purchase, and provides a typed Purchase result.

Telegram Premium

purchase = api.buy_premium(
    username="@telegram_user",
    months=3,
    payment_method="usdt",
    seed=os.environ["TON_WALLET_SEED"],
)

result = api.wait(purchase.purchase_id)

Premium durations are 3, 6, or 12 months.

Payments

Value Payment
gram GRAM on TON
usdt USDT on TON

USDT purchases require a small GRAM balance for the network fee.

Public API

Method Purpose
buy_stars() Buy 50 or more Telegram Stars
buy_premium() Buy Telegram Premium
create_purchase() Create a purchase with explicit product fields
get_purchase() Read the latest purchase state
wait() Poll until the purchase reaches a terminal state

No authentication token or API key is required.

Links

Independent developer project. Not affiliated with Telegram or Fragment.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fragment_api_dev-1.0.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fragment_api_dev-1.0.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file fragment_api_dev-1.0.0.tar.gz.

File metadata

  • Download URL: fragment_api_dev-1.0.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.3

File hashes

Hashes for fragment_api_dev-1.0.0.tar.gz
Algorithm Hash digest
SHA256 43ffffda4a5e2e90c92bf33f121877032f991c1805d6b40dd46c4496c3903a2c
MD5 9cbc566e036aa5cf00e38ae4d1c7df86
BLAKE2b-256 af7cf9cad701c99c1d7efb488bf8ceff05e13dbfa5823c0fb3e5080052e99c21

See more details on using hashes here.

File details

Details for the file fragment_api_dev-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fragment_api_dev-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d18c40cdbcf6ccd7bc8b7efcdabfaa1efdef78a1a9f3f99ba68c9ee9f2c41e95
MD5 d76aed1693b7fa6dc8a2f4751c42af17
BLAKE2b-256 d6446c9913a00df474b8b1f92e83b846d683a92404d0d128eacc835fb581dfe3

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.0

2 files

1.1.0

2 files

1.0.1

2 files

This release

1.0.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page