Skip to main content

fazercards-python-sdk

Python FazerCards Typed Async Ruff License

Typed Python client for the FazerCards reseller API. Game top-ups, gift cards, Telegram Stars and Premium, Steam wallet, orders and signed webhooks. Sync and async, with retry rules built so an order is never placed twice.

pip install fazercards-python-sdk

Top up a game

from fazercards_sdk import FazerCards

with FazerCards("API_KEY") as fc:
    check = fc.topups.validate("free_fire", "123456789")
    if check.valid:
        order = fc.topups.order("free_fire_cis", "110_diamonds", "123456789", idempotency_key="ORDER-1042")

order.status moves from created to processing to completed, or to failed / refund with order.fail_reason. Follow it by webhook, or with fc.orders.wait(order.id).

Sell a gift card

order = fc.giftcards.order("playstation_tr", "250_try", quantity=1, idempotency_key="ORDER-1043")
order.codes

FazerCards can answer a gift card order with completed and an empty cards list, then fill the list a moment later. The client reads the order again before it returns (code_checks, default 3). If the codes still have not arrived, order.awaiting_codes is True: keep the order open and read it later, never show the customer an empty result.

Telegram and Steam

fc.telegram.stars_quote().price(500)
fc.telegram.buy_stars("@username", 500)
fc.telegram.buy_premium("username", months=12)

if fc.steam.check_login("steam_login").valid:
    fc.steam.order("steam_login", "19.50", "USD", idempotency_key="ORDER-1044")

Catalog

games = fc.topups.all_categories()
cards = fc.giftcards.all_categories()
offers = fc.topups.offers("free_fire_cis")
offers.get("110_diamonds").price
offers.fields
fc.giftcards.cards("playstation_tr").offers[0].stock

Categories come in cursor pages of up to 500 (fc.topups.categories(limit, cursor)); all_categories() follows the cursor. Orders come in numbered pages of up to 100 (fc.orders.list(page, limit), fc.orders.recent(count)).

Webhooks

event = fc.verify_webhook(request.body, headers=request.headers)
if event.needs_lookup:
    order = fc.orders.get(event.order_id)

The body is checked against X-Webhook-Signature (HMAC SHA256 of the raw body, sha256= prefix optional) in constant time. Set the address with fc.account.set_webhook("https://shop.example/webhook/fazercards"). See examples/fastapi_webhook.py.

Safety

Situation What the client does
Connection refused, nothing sent Retries, then NotSentError
Timeout, cut connection or 5xx on an order No retry, OutcomeUnknownError with the idempotency_key
Same failure on a read Retries with backoff, then TransportError
429 Waits Retry-After and retries, the request was not processed
resend_keyed_orders=True An order with an Idempotency-Key is resent once with the same key
Telegram purchase Takes no key on the API side, so it is never resent
Reused key that returns another item KeyCollisionError, never counted as success
Gift card completed without codes Read again, then order.awaiting_codes
Quantity, months, amount like 1.005 or True InvalidRequestError before anything is sent
base_url over plain http ConfigurationError, except localhost or allow_insecure_http
Webhook body over 256 KB Rejected before hashing

Every top-up, gift card and Steam order carries an Idempotency-Key. Pass your own order number, so a double click or a crash can not buy twice. With several shops on one account set idempotency_prefix. Prices are Decimal end to end. fc.rate_limit keeps the last X-RateLimit-* headers.

Endpoints

Namespace Methods
topups categories all_categories offers validation_games validate order
giftcards categories all_categories cards order
orders get list recent wait
telegram stars_quote premium_quote buy_stars buy_premium
steam rates check_login order
account me balance webhook set_webhook
client balance verify_webhook request

AsyncFazerCards has the same methods, awaited.

Errors

FazerCardsError is the base. API answers raise APIError subclasses by status: BadRequestError (400), AuthenticationError (401, 403), NotFoundError (404), ConflictError (409), RateLimitError (429), ServerError (5xx). Each carries status_code, message and the raw body.

Config

Pass values in code, or set FAZERCARDS_API_KEY, FAZERCARDS_WEBHOOK_SECRET, FAZERCARDS_BASE_URL, FAZERCARDS_IDEMPOTENCY_PREFIX, FAZERCARDS_TIMEOUT, FAZERCARDS_MAX_RETRIES, or put them in fazercards.toml (example). Every path is a setting (FAZERCARDS_ENDPOINTS__BALANCE=...). Messages live in messages.yaml and can be replaced with messages.use(...).

Develop

pip install -e ".[dev]" && pytest && ruff check . && mypy src

License

MIT

Metadata

Release files for fazercards-python-sdk 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fazercards-python-sdk 0.1.1
File Size Uploaded Provenance Actions
fazercards_python_sdk-0.1.1.tar.gz 27.3 kB Without provenance Details for fazercards_python_sdk-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fazercards-python-sdk 0.1.1
File Interpreter ABI Platform Actions
fazercards_python_sdk-0.1.1-py3-none-any.whl Python 3 none any Details for fazercards_python_sdk-0.1.1-py3-none-any.whl

Total release size: 51.6 kB

Release files / fazercards_python_sdk-0.1.1.tar.gz

Download URL fazercards_python_sdk-0.1.1.tar.gz
Size 27.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a7e6e57ebccb0830e1e92989c85295436d608d2f2901ad51e6ba5e4537abd2d8
BLAKE2b-256 checksum
How to use checksums
dae683663c72eb2a506f8d54609c2e0ade92464f3796a026585d511c06249811
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fazercards_python_sdk-0.1.1-py3-none-any.whl

Download URL fazercards_python_sdk-0.1.1-py3-none-any.whl
Size 24.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f12a1c950fac0adc856ddb67fe25bbc5dd34c093c5dd82837ba0e4fcbf773359
BLAKE2b-256 checksum
How to use checksums
367931122514876d777191c21d10b103eafdf874c0824ce19cec792382736ff7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for fazercards-python-sdk 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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