stackin
Python SDK for fiscal document issuance — a handful of business fields, nothing about certificates, XML, XSD, signing or SOAP. The API resolves all of that from the issuer's own configuration, identified by api_key.
One class, Invoice — issue()/consult()/cancel(), nothing else to instantiate. Each line item is a Product (stackin.br) — description/amount are universal, everything else (ncm/cfop/cest/tax groups...) is Brazil-specific and only required for NFE; NFSE ignores it.
Install
pip install stackin-python-sdk
Usage
Get an api_key from the stackin dashboard — select the issuing company, then Settings → API key (context sdk). One key per issuing company, shown once at creation. The API resolves the issuer (CNPJ, state, address, certificate, environment) entirely from it; nothing about the issuer is ever passed on a call.
from stackin import Invoice, DocumentType, Address
from stackin.br import Product # Brazil-specific line item — NCM/CFOP
client = Invoice(api_key="COMPANY_API_KEY") # defaults to https://sdk.stackin.io
invoice = client.issue(
document_type=DocumentType.NFSE,
client_name="John Doe",
tax_id="00000000000",
items=[Product(description="Software development", amount=5000.00)],
)
status = client.consult("ACCESS_KEY...", document_type=DocumentType.NFSE)
client.cancel(
"ACCESS_KEY...",
document_type=DocumentType.NFSE,
reason="Typo",
)
# NFE requires ncm/cfop on every item, and optionally recipient_address.state
# to get idDest right on interstate sales:
client.issue(
document_type=DocumentType.NFE,
client_name="Buyer Company Ltd",
tax_id="11111111111111",
items=[Product(description="Test product", amount=100.00, ncm="84713012", cfop="5102")],
recipient_address=Address(state="RJ"),
)
recipient_address is an Address, but despite the name only .state is read — the rest of the fields aren't sent anywhere yet. It's the actual customer's state, used only to set idDest (interstate vs internal) on NFE — optional, omitting it always produces idDest=1 (internal).
items is a list of Product (stackin.br) — description/amount apply to any document type; ncm/cfop (plus everything else on Product: cest, tax groups, presumed credits...) are Brazil-specific and required per item for NFE, ignored for NFSE (a service isn't a physical good).
Errors
stackin.APIError— the API responded with a non-2xx status (status_code,detail) — a 401 here meansapi_keyis missing, wrong, or was rotated.stackin.ConnectionFailedError— the API didn't respond (network/DNS/timeout).ValueError—issue()'sitemsis empty, or missingncm/cfopon an item for NFE.
Building the full fiscal document (issuer data, service code, tax groups, schema-accurate XML) is the API's job — configured once per company, not passed on every call.
Examples
Runnable end-to-end scripts in examples/nfe/ and examples/nfse/ — one file per field/variant, from the bare minimum to every field filled.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stackin_python_sdk-0.1.2.tar.gz.
File metadata
- Download URL: stackin_python_sdk-0.1.2.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c97a1bbc29b95084290b5c5aa55fc1595a4106dd4e40c67fe10c72fee8854c4
|
|
| MD5 |
7e5139f74596a398729c46adf662b7f0
|
|
| BLAKE2b-256 |
1fd6c60b572a7f9849c1f3cc7736d78c57cc0fce46c62bbab7a4bf8c0436bb28
|
Provenance
The following attestation bundles were made for stackin_python_sdk-0.1.2.tar.gz:
Publisher:
python-publish-pypi.yml on stackin-io/stackin-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stackin_python_sdk-0.1.2.tar.gz -
Subject digest:
8c97a1bbc29b95084290b5c5aa55fc1595a4106dd4e40c67fe10c72fee8854c4 - Sigstore transparency entry: 2687831617
- Sigstore integration time:
-
Permalink:
stackin-io/stackin-python-sdk@42475cbdcc735b6a90847a7a90fe1a447573caeb -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/stackin-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish-pypi.yml@42475cbdcc735b6a90847a7a90fe1a447573caeb -
Trigger Event:
release
-
Statement type:
File details
Details for the file stackin_python_sdk-0.1.2-py3-none-any.whl.
File metadata
- Download URL: stackin_python_sdk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74ad10f2e9d8ef8f6d764a6c9064671c3da2baf1403639c0ca326111e4bfe62f
|
|
| MD5 |
49a5ac56ed800a3d2922d8d415ac504a
|
|
| BLAKE2b-256 |
0e3fed0249016a5f63f0a3308521f93527454d8c186d01a3d6e4d6e11faa27b0
|
Provenance
The following attestation bundles were made for stackin_python_sdk-0.1.2-py3-none-any.whl:
Publisher:
python-publish-pypi.yml on stackin-io/stackin-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stackin_python_sdk-0.1.2-py3-none-any.whl -
Subject digest:
74ad10f2e9d8ef8f6d764a6c9064671c3da2baf1403639c0ca326111e4bfe62f - Sigstore transparency entry: 2687832325
- Sigstore integration time:
-
Permalink:
stackin-io/stackin-python-sdk@42475cbdcc735b6a90847a7a90fe1a447573caeb -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/stackin-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish-pypi.yml@42475cbdcc735b6a90847a7a90fe1a447573caeb -
Trigger Event:
release
-
Statement type: