---
title: "Python SDK"
description: "Install, use, and observe the official Inttegro SDK for Python."
canonical: "https://studio.inttegro.com/sdks/python"
format: inttegro-machine-docs/v1
language: "Java"
sdk_version: "v8.3.0"
reader_profile: optional
reader_manifest: "https://studio.inttegro.com/machine/java/readers/index.json"
reader_identification: "Optional: declare your client only if known and your current-session capabilities; use reader_manifest for supplemental recommendations."
preamble_estimated_tokens: 571
model_token_report: "https://studio.inttegro.com/machine/token-report.json"
preamble_questions: 5
preamble_source: "general"
recommended_mcp_tools: ["get_integration_guide","check_integration_readiness"]
estimated_tokens: 2033
token_estimate_method: "utf8_bytes_divided_by_4"
---

## Machine preamble

**Summary:** Install, use, and observe the official Inttegro SDK for Python. This Java representation uses the selected SDK's native names wherever Studio has a verified mapping.

### Five questions

#### Q1. When should the reader use Python SDK?

Use this SDK guide when the selected runtime or framework matches the application being built.

#### Q2. What is authoritative on this page?

Use this page for orientation; follow its canonical SDK, guide, API, or MCP links for exact contracts.

#### Q3. What page-specific constraint matters most?

Use the current documented SDK version and native public API; do not invent members from JSON names or another language.

#### Q4. Can Inttegro MCP materially help with this task?

Yes, when the reader has an authenticated MCP connection and the task needs live context, guided planning, or a supported operation. The strongest matches are `get_integration_guide`, `check_integration_readiness`; their exact roles and boundaries are listed below.

#### Q5. How should the reader verify the answer and continue?

Install the documented version, compile or type-check the smallest example, run it against a disposable application, and verify the resulting resource through its canonical lookup. Continue with [Choose an API resource](https://studio.inttegro.com/machine/java/api.md) and [Compare the Python demos](https://studio.inttegro.com/machine/java/demos.md#server-and-full-stack-demos) when those concerns enter scope.

### Recommended MCP assistance

Use these through an authenticated Inttegro MCP connection. This document remains the contract source.

- [`get_integration_guide`](https://studio.inttegro.com/machine/java/inttegro-mcp/tools.md#get_integration_guide) — read-only integration guidance. Returns a focused implementation sequence and canonical Studio links for authentication, checkout, orders, catalog, messaging, idempotency, or testing.
- [`check_integration_readiness`](https://studio.inttegro.com/machine/java/inttegro-mcp/tools.md#check_integration_readiness) — read-only integration guidance. Audits platform secret storage, server-runtime compatibility, idempotency, errors, state verification, checkout returns, and messaging consent without receiving source code or credentials.

## Document content

# Inttegro Python SDK

The [Inttegro Python SDK](https://pypi.org/project/inttegro/) builds server-side
integrations with typed request dataclasses, immutable domain objects,
JSON-compatible enums, and Python-native resource namespaces.

:::tip Start with MCP

Before writing SDK code, [connect your MCP client](https://studio.inttegro.com/machine/java/inttegro-mcp/connect.md) and ask
MCP to [design the integration](https://studio.inttegro.com/machine/java/inttegro-mcp/design-integration.md) for
your Python application. Use the resulting implementation and test plan to
guide the code you write with this SDK.

:::

## Install

The SDK requires [Python 3.10 or newer](https://www.python.org/downloads/).
Install the package from [PyPI](https://packaging.python.org/en/latest/tutorials/installing-packages/):

```bash
pip install inttegro
```

:::warning Keep the SDK on the server

[Load the secret API key securely](https://studio.inttegro.com/machine/java/api/authentication.md#store-credentials-safely)
from server-side code. Never place the key in browser code, a mobile
application, or source control.

:::

## Create an async client

Use `AsyncInttegroClient` in FastAPI, async Django views, Python Workers, and
other event-loop applications. Create one client for the application lifetime
so its HTTP connection pool can be reused, and close it during shutdown.

```python
import os

import inttegro
from inttegro import AsyncInttegroClient

client = AsyncInttegroClient(
    api_key=os.environ["INTTEGRO_API_KEY"],
)


async def create_order(
    request: inttegro.order.CreateRequest,
) -> inttegro.order.Order:
    return await client.orders.create(request)


async def shutdown() -> None:
    await client.aclose()
```

Request classes live in singular resource packages, such as
`inttegro.order.CreateRequest`. Returned resources are typed domain objects
with attribute access, mapping access, and `to_dict()`.

## Navigate typed resources

The main object has the same name as its singular package. Related models and
enums stay beside it, so imports and autocomplete remain focused:

```python
from inttegro import payment, product

catalog_product = product.Product.from_dict(product_data)

if catalog_product.type == product.Type.DIGITAL and catalog_product.is_published():
    # Offer the product for sale.
    pass

payment_result = payment.Payment.from_dict(payment_data)

if payment_result.status == payment.Status.REQUIRES_ACTION:
    next_action = payment_result.required_action()
```

Question methods such as `is_paid()`, `requires_action()`, `is_terminal()`,
`is_published()`, and `is_reusable()` inspect the current object only. They
never make an API request.

For synchronous Django or Flask views, scripts, and jobs, use
`InttegroClient`. Do not call the synchronous client directly from an async
handler: it blocks the event loop, and runtimes such as Cloudflare Python
Workers cannot offload that work to an OS thread.

## See it in a complete app

Use either demo to follow a ticket sale from reservation to Inttegro Checkout:

- [Django ticket checkout](https://studio.inttegro.com/machine/java/demos/django.md) — a server-rendered booking flow for
  an event organizer
- [FastAPI ticket checkout](https://studio.inttegro.com/machine/java/demos/fastapi.md) — an API-first flow that can serve
  web, mobile, or another sales surface

Both keep the ticket, price, and fulfillment decision on the server and use
the Python SDK to create the payable order.

## Observability

The global [OpenTelemetry provider](https://opentelemetry.io/docs/languages/python/)
is used automatically. Pass a provider when the client should use an explicitly
managed tracing pipeline:

```python
import os

from inttegro import AsyncInttegroClient
from opentelemetry import trace

client = AsyncInttegroClient(
    api_key=os.environ["INTTEGRO_API_KEY"],
    tracer_provider=trace.get_tracer_provider(),
)
```

> Server Sdk Observability is interactive content. Use the canonical page to view it.

### Report SDK failures

Pass an application-owned callback to receive one immutable, typed report after
an SDK operation finally fails:

```python
import os

import inttegro
from inttegro import AsyncInttegroClient


def enqueue_error(report: inttegro.ErrorReport) -> None:
    payload = report.to_dict()
    _ = payload  # Forward the payload to your collector or queue.


client = AsyncInttegroClient(
    api_key=os.environ["INTTEGRO_API_KEY"],
    error_reporter=enqueue_error,
)
```

> Server Sdk Error Reporting is interactive content. Use the canonical page to view it.

## Continue

- [Browse the generated API reference](https://python.inttegro.dev/v12.0.0/)
- [View the package on PyPI](https://pypi.org/project/inttegro/)
- [Browse the source and releases](https://github.com/inttegro/inttegro-sdk-python)
- [Compare the Python demos](https://studio.inttegro.com/machine/java/demos.md#server-and-full-stack-demos)
- [Choose an API resource](https://studio.inttegro.com/machine/java/api.md)
