Skip to main content

Cheqi Python SDK for end-to-end encrypted receipt processing

Project description

Cheqi Python SDK

Python SDK for end-to-end encrypted receipt and credit note processing via the Cheqi API.

Installation

pip install cheqi-sdk

Or with uv:

uv add cheqi-sdk

Quick Start

from cheqi import CheqiSDK, Environment
from cheqi.models import (
    IdentificationDetails,
    CardDetails,
    ReceiptTemplateRequest,
    Product,
    Tax,
    UnitCode,
    PaymentType,
    CardProvider,
)
from decimal import Decimal

# Initialize the SDK
sdk = CheqiSDK(
    environment=Environment.PRODUCTION,
    api_key="sk_live_...",
)

# Build identification details
identification = IdentificationDetails(
    payment_type=PaymentType.CARD_PAYMENT,
    card_details=CardDetails(
        payment_account_reference="PAR123456",
        card_provider=CardProvider.VISA,
    ),
)

# Build a receipt request
product = Product(
    name="Laptop",
    identifier="LAP-001",
    quantity=1.0,
    base_quantity=1.0,
    unit_code=UnitCode.ONE,
    unit_price=Decimal("1000.00"),
    subtotal=Decimal("1000.00"),
    total=Decimal("1210.00"),
    taxes=[Tax(rate=21.0, type="VAT", taxable_amount=Decimal("1000.00"), amount=Decimal("210.00"))],
)

receipt_request = ReceiptTemplateRequest(
    document_number="INV-2024-001",
    currency="EUR",
    receipt_subtotal=Decimal("1000.00"),
    total_before_tax=Decimal("1000.00"),
    total_tax_amount=Decimal("210.00"),
    total_amount=Decimal("1210.00"),
    products=[product],
    taxes=[Tax(rate=21.0, type="VAT", taxable_amount=Decimal("1000.00"), amount=Decimal("210.00"))],
)

# Process the complete receipt (match -> template -> encrypt -> send)
result = sdk.receipt_service.process_complete_receipt(
    identification_details=identification,
    receipt_request=receipt_request,
)

if result.success:
    print(f"Receipt delivered! ID: {result.cheqi_receipt_id}")

Chainable Model Building

Models are immutable. Convenience methods return new instances:

request = (
    ReceiptTemplateRequest(document_number="INV-001", currency="EUR")
    .add_product(product1)
    .add_product(product2)
    .add_tax(tax1)
    .add_discount(discount1)
)

Authentication

sdk = CheqiSDK(
    environment=Environment.PRODUCTION,
    api_key="sk_live_...",
)

Development

uv sync --extra dev
uv run pytest
uv run ruff check src/ tests/
uv run mypy src/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cheqi_sdk-0.1.2.tar.gz (28.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cheqi_sdk-0.1.2-py3-none-any.whl (35.9 kB view details)

Uploaded Python 3

File details

Details for the file cheqi_sdk-0.1.2.tar.gz.

File metadata

  • Download URL: cheqi_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 28.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cheqi_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 fe1d646f46c6cdc38975568e0e8f096c29cc3c1b61d84fdc70fad174309fd887
MD5 10aab047dbc8bcac7ea66f41eadc77f1
BLAKE2b-256 96059056c6a00a5ec838f133e0e4dca77e9415d9bc6a99e0d5074e397768634a

See more details on using hashes here.

Provenance

The following attestation bundles were made for cheqi_sdk-0.1.2.tar.gz:

Publisher: publish.yml on cheqi-io/cheqi-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cheqi_sdk-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: cheqi_sdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 35.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cheqi_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 85ce1a4ffff6c494df8d36fa020c5327d9355dacc823e40ec26ecfdba159b2e9
MD5 acc8e48c15282e6772127a6b1cfb7c3b
BLAKE2b-256 8c33eacbc770bbdced67982b3d8b5d18853f51d3cc7125fbf4fc1b544d986d10

See more details on using hashes here.

Provenance

The following attestation bundles were made for cheqi_sdk-0.1.2-py3-none-any.whl:

Publisher: publish.yml on cheqi-io/cheqi-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page