Skip to main content

fazercards-python-sdk

PyPI Docs 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.2

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.2
File Size Uploaded Provenance Actions
fazercards_python_sdk-0.1.2.tar.gz 32.3 kB Without provenance Details for fazercards_python_sdk-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 56.7 kB

Release files / fazercards_python_sdk-0.1.2.tar.gz

Download URL fazercards_python_sdk-0.1.2.tar.gz
Size 32.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ce1a29e58e0fe76360bd7afc844ae0631a0aae3c121321c960165caf18144a36
BLAKE2b-256 checksum
How to use checksums
2b70b6aead0a0accb7d1c4670aad6f7729e238b908ad761a2fa805ada72832a7
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.2-py3-none-any.whl

Download URL fazercards_python_sdk-0.1.2-py3-none-any.whl
Size 24.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97239e9e7256593799920a76bb6d7296248790f6a7047a86ea51706f11f0408d
BLAKE2b-256 checksum
How to use checksums
147eb2549bdce5332d65e6c36e4883c5d58643215d535726e9cce6807e75b0c5
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.2

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.2 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