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

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.1.tar.gz (7.5 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.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fragment_api_dev-1.0.1.tar.gz
  • Upload date:
  • Size: 7.5 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.1.tar.gz
Algorithm Hash digest
SHA256 1aad2f3361f2eb2b40b9eb43e87ba6cfc0e74d8f6c3fef6209b7ca86cd43d785
MD5 4460800cacd185db8ec7ac5ff0b85662
BLAKE2b-256 0e0fdd15bb45e836641c13c6e70e6c9ce78b4b65ab4b46da0178726e9bcdba8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fragment_api_dev-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 71842ac7279248fab299f8658b3a1cebcc0d79648caa6a810854907c9c51a6ee
MD5 d4084c40e5d4742a0635e6b7737aa9f9
BLAKE2b-256 e479391fe8fbeb8047da1c8f81ac5e6eec2e5c139f742cc3bb41d586aa63f5cc

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.0

2 files

1.1.0

2 files

This release

1.0.1 This release

2 files

1.0.0

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