Metadata-Version: 2.4
Name: ia-erp-dte
Version: 1.0.0
Summary: SDK oficial de Python (cero dependencias) para la API Pública de DTE de IA ERP (Chile SII).
Author-email: IA ERP <soporte@ia-erp.cl>
License-Expression: MIT
Project-URL: Homepage, https://ia-erp.cl
Project-URL: Documentation, https://docs.ia-erp.cl/sdks
Project-URL: Repository, https://github.com/IA-ERP/sdk-python
Project-URL: Issues, https://github.com/IA-ERP/sdk-python/issues
Keywords: ia-erp,dte,sii,chile,boleta,factura,facturacion-electronica,webhooks
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# `ia-erp-dte` — SDK oficial de Python

SDK oficial con **cero dependencias externas** (Python 3.10+) para la [API Pública de DTE de IA ERP](https://docs.ia-erp.cl) (SII de Chile).

- Emisión idempotente de Boletas (39/41), Facturas (33/34), Guías (52) y NC/ND (61/56)
- Sandbox (`sk_test_`) y producción (`sk_live_`) con el mismo cliente
- PDF carta, PDF cedible, **PDF térmico 80 mm POS** y XML firmado
- Reintentos automáticos en `429`/`5xx` preservando `Idempotency-Key`
- Errores RFC 9457 (`IaErpApiError`) y verificación HMAC-SHA256 de webhooks (`verificar_firma_webhook`)

## Instalación

```bash
pip install ia-erp-dte
```

## Inicio rápido

```python
import os
from ia_erp_dte import IaErpClient

client = IaErpClient(api_key=os.environ["IAERP_DTE_API_KEY"])

res = client.dte.emitir(
    {
        "tipo_dte": 39,
        "precios_incluyen_iva": True,
        "referencia_externa": "ORD-2026-00481",
        "items": [{"nombre": "Suscripción mensual", "cantidad": 1, "precio_unitario": 19990}],
    },
    idempotency_key="ORD-2026-00481",
)

pdf_80mm = client.dte.pdf(res.documento["id"], formato="termico_80mm")
```

## Verificar webhooks firmados (HMAC-SHA256)

```python
from ia_erp_dte import verificar_firma_webhook

valido = verificar_firma_webhook(raw_body, request.headers.get("X-IAERP-Signature"), webhook_secret)
```

## Enlaces

- Documentación: [docs.ia-erp.cl](https://docs.ia-erp.cl)
- Especificación OpenAPI 3.1: [dte.ia-erp.cl/openapi.json](https://dte.ia-erp.cl/openapi.json)
- Estado del servicio: [status.ia-erp.cl](https://status.ia-erp.cl)
