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

Two modes are supported:

# API Key (for companies accessing their own data)
sdk = CheqiSDK(
    environment=Environment.PRODUCTION,
    api_key="sk_live_...",
)

# OAuth2 Client Credentials (for third-party integrations)
sdk = CheqiSDK(
    environment=Environment.PRODUCTION,
    client_id="your_client_id",
    client_secret="your_client_secret",
)
# Pass access_token to service methods

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.0.tar.gz (27.7 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.0-py3-none-any.whl (35.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cheqi_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 27.7 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.0.tar.gz
Algorithm Hash digest
SHA256 3d1f731af860dc7928c085ce86d7e00c65490ec0a9e40d601b0134a2af1d6c74
MD5 94daa1c3564eea05ba973d0f45005022
BLAKE2b-256 05fa38f1d1b3654da56c7b2df3227cd9e815bdc409f09019878730ea80626696

See more details on using hashes here.

Provenance

The following attestation bundles were made for cheqi_sdk-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: cheqi_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 35.5 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9950b5633b1e04b1a99c9134e42e070437b0ab22a9a20e9bc2e5826a0c408228
MD5 663680304b6aa949a4562f3af3e41d50
BLAKE2b-256 ff482bc9327f0392948c915bacb03854c90a28a769934f6bccf7d5e3f786b988

See more details on using hashes here.

Provenance

The following attestation bundles were made for cheqi_sdk-0.1.0-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