Frameworks
Django — Scell.io integration
No official Python SDK — direct HTTP call via requests
Scell.io does NOT publish an official Python SDK (only TypeScript and PHP are supported). In Django, integrate via `requests` library by calling `POST /api/v1/invoices` directly with `X-API-Key` header. Wrap in a Python service (`services/scell.py`) injected into views. For async, use `httpx` or Celery for jobs.
Key facts
- No official Python SDK — use `requests` or `httpx`
- Required header: `X-API-Key: sk_live_xxx`
- Endpoint: `POST https://api.scell.io/api/v1/invoices`
- Store `SCELL_API_KEY` in `settings.py` via env var
- For async: Celery task or Django 5.0 async views
Code example
import requests
from django.conf import settings
def create_invoice(buyer_name: str, amount: float) -> dict:
payload = {
'format': 'factur-x',
'buyer': {'name': buyer_name, 'is_individual': True},
'lines': [{'description': 'Service', 'quantity': 1, 'unit_price': amount, 'vat_rate': 20.0}],
}
r = requests.post(
'https://api.scell.io/api/v1/invoices',
json=payload,
headers={'X-API-Key': settings.SCELL_API_KEY},
timeout=30,
)
r.raise_for_status()
return r.json()