Skip to main content

billa

Credit-based billing for Django APIs.

billa provides a pluggable payment backend (Stripe, PayPal, or a local stub for development), a credit pack catalogue, per-key balance tracking, and a BillerThrottle that enforces credit limits on API requests.

Part of the lxcor/api-suite.

Install

pip install lxcor-billa           # core + stub backend
pip install lxcor-billa[stripe]   # include Stripe
pip install lxcor-billa[paypal]   # include PayPal

Setup

# settings.py
INSTALLED_APPS = [
    ...
    'reggi',  # required
    'kotta',  # required
    'billa',
]

REST_FRAMEWORK = {
    'DEFAULT_THROTTLE_CLASSES': [
        'kotta.throttle.AnonEndpointThrottle',
        'kotta.throttle.TierThrottle',
        'billa.throttle.BillerThrottle',
    ],
}
# urls.py
urlpatterns = [
    path('', include('billa.urls')),
]

Settings

Setting Default Description
BILLA_PAYMENT_BACKEND 'billa.backends.stub.StubPaymentBackend' Active payment backend
BILLA_MERCHANT_NAME '' Merchant name shown on terms and pricing pages
BILLA_CONTACT_EMAIL '' Contact email shown on terms page
BILLA_CURRENCY 'USD' Currency code for all transactions
BILLA_SUCCESS_URL '' Redirect URL after successful checkout
BILLA_CANCEL_URL '' Redirect URL after cancelled checkout
BILLA_UPGRADE_URL '' URL appended to 402 responses when credits are exhausted
BILLA_STRIPE_MODE 'test' 'test' or 'live'
BILLA_PAYPAL_MODE 'sandbox' 'sandbox' or 'live'
{% include "billa/_navbar_links.html" %}   {# Pricing link #}
{% include "billa/_footer_links.html" %}   {# Terms link #}

Management commands

Command Description
dumppacks Export credit pack catalogue to JSON
loadpacks Import credit pack catalogue from JSON

License

MIT

Metadata

Release files for lxcor-billa 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 lxcor-billa 0.1.2
File Size Uploaded Provenance Actions
lxcor_billa-0.1.2.tar.gz 29.2 kB Without provenance Details for lxcor_billa-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lxcor-billa 0.1.2
File Interpreter ABI Platform Actions
lxcor_billa-0.1.2-py3-none-any.whl Python 3 none any Details for lxcor_billa-0.1.2-py3-none-any.whl

Total release size: 67.2 kB

Release files / lxcor_billa-0.1.2.tar.gz

Download URL lxcor_billa-0.1.2.tar.gz
Size 29.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5ec060b48c995b6e5151a594a15419989ea21fa64a28ae0ca6314bcf891659f7
BLAKE2b-256 checksum
How to use checksums
03014f059dd48f14dcd41da3e22faea692e9f3abb7fa7dd309537872c1dba1ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / lxcor_billa-0.1.2-py3-none-any.whl

Download URL lxcor_billa-0.1.2-py3-none-any.whl
Size 38.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1016cd746891d63e6872086c6bfe0aa3daaaced6cd842369ab7ea7dffb8646a5
BLAKE2b-256 checksum
How to use checksums
7fc8d10c0c9101ac9a62d771ea3b9da3354db083e9503002a4672c18422ec4b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Security for lxcor-billa 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.

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