Skip to main content

sendclap (Python)

Official Python client for Sendclap: check license keys from the app you ship, and call the creator REST API from your server. Standard library only, Python 3.9+, fully typed. API reference: https://sendclap.com/docs

pip install sendclap

License check (in your app, no API key)

import time
from sendclap import LicenseClient, NetworkError, instance_name

def licensed(key: str, cache: dict) -> bool:
    try:
        r = LicenseClient().validate(key, cache.get("instance") or instance_name())
    except NetworkError:  # offline: allow a 7-day grace period since the last good check
        return time.time() - cache.get("validated_at", 0) < 7 * 86400
    if r.valid:
        cache["validated_at"] = time.time()  # persist cache to disk yourself
    return r.valid  # status "invalid", "disabled" or "not_activated": lock the app

On first run, activate the device and remember the instance id:

from sendclap import ActivationLimitError, DisabledLicenseError, InvalidLicenseError
try:
    cache["instance"] = LicenseClient().activate(key, instance_name()).instance_id
except InvalidLicenseError: ...   # unknown key
except DisabledLicenseError: ...  # the payment was refunded or disputed
except ActivationLimitError as e: print(f"Used on {e.license.activations}/{e.license.max_activations} devices")

deactivate(key, instance_id) frees the device again, and raises InstanceNotFoundError if it wasn't activated. validate never raises for a bad key; it returns status "active", "not_activated", "invalid" (unknown key) or "disabled" (refunded or disputed), and raises NetworkError only when it could not reach Sendclap, so you can tell "offline" from "invalid" and show "this license was refunded" for "disabled".

Instance name: instance_name() is the machine's hostname. It is sent to Sendclap and shown to the creator, and two machines with the same hostname share one activation. If that matters, pass your own stable id instead (for example a uuid4() saved on first run). The instance id Sendclap returns is the name you send.

Creator API (server side only)

Never ship your sc_ API key inside an app, website or anything a customer can download. Anyone holding it can read your payments and customers. Use it only on your own server.

from sendclap import ApiClient

api = ApiClient("sc_your_key")  # base_url="https://sendclap.com", timeout=15.0
checkout = api.create_checkout("product", product_id=1, email="buyer@example.com")
print(checkout["url"])            # send the buyer here
api.get_checkout(checkout["id"])  # poll until status == "paid"
page = api.list_payments(status="paid", limit=10)  # page.data, page.has_more, page.next
if page.has_more:
    page = api.list_payments(status="paid", limit=10, after=page.next)
for p in api.all_payments(status="paid"):  # a generator that follows `next` across pages
    print(p["amount"], p["email"])

Lists (list_payments, list_members, list_licenses, list_disputes) return a Page with data, has_more and next, newest first; limit is at most 500 and after is the previous page's next. all_payments, all_members, all_licenses and all_disputes take the same filters and yield every item.

Methods: create_checkout and get_checkout (both return the checkout url), me, get_payment, list_products, list_memberships, the list and all_* methods above, and get_creator (public, works with ApiClient() and no key). Items are plain dicts with the API's JSON fields, typed with TypedDict.

The client is synchronous. In async code, wrap calls with await asyncio.to_thread(api.me).

Errors

Every exception is a SendclapError with .status, .code (the server's machine-readable code) and .message. The typed ones are chosen by code:

Exception code When
InvalidLicenseError license_not_found 404: the key doesn't exist
DisabledLicenseError license_disabled 403: disabled after a refund or dispute
InstanceNotFoundError instance_not_found 404: deactivate for an instance that isn't activated
ActivationLimitError activation_limit 409: every activation is used; .license and .product say how many
NetworkError network_error No response: offline, DNS, TLS, timeout (.status == 0)
SendclapError anything else e.g. bad_request, invalid_api_key, not_found

Tests

python3 -m unittest discover -s tests   # or: python3 -m pytest

Metadata

Release files for sendclap 0.2.0

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

Source distribution (sdist)

Source distribution for sendclap 0.2.0
File Size Uploaded Provenance Actions
sendclap-0.2.0.tar.gz 8.9 kB With provenance Details for sendclap-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sendclap 0.2.0
File Interpreter ABI Platform Actions
sendclap-0.2.0-py3-none-any.whl Python 3 none any Details for sendclap-0.2.0-py3-none-any.whl

Total release size: 16.1 kB

Release files / sendclap-0.2.0.tar.gz

Download URL sendclap-0.2.0.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f5b675cc27462bcaa7b840a89d2c2e1fd984c9b641ecac7fec802ff2af126c93
BLAKE2b-256 checksum
How to use checksums
7f262182f1f202a1add774874a6a956ecf4d83f879c80fefebf162e66859577a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / sendclap-0.2.0-py3-none-any.whl

Download URL sendclap-0.2.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5632231285b345f8078d00c9da70c7637759037905804f9cdb6da319b33f64b0
BLAKE2b-256 checksum
How to use checksums
a4d75b64ca255d66906f51841af4e3bbd2d3c7c767a6a3b218c0267e9889951d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for sendclap 0.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sendclap-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

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.

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