Skip to main content

Inttegro Python SDK

OpenSSF Scorecard

The official Python client for building server-side Inttegro integrations, with native asynchronous and synchronous clients.

API documentation · Integration guides

Fastest, most modern path: connect an agent to Inttegro MCP at https://mcp.inttegro.com, then ask it to run design_integration. It will produce an implementation and test plan for your application. Use this SDK when you are ready to connect that plan to your Python service.

All official Inttegro SDKs expose the same API capabilities. This package adds Python-specific data access, transports, and test seams.

Install

Requires Python 3.10 or newer.

pip install inttegro

Store your secret key in the server environment:

export INTTEGRO_API_KEY="your_secret_key"

Never put the key in browser code, a mobile app, or source control. The client uses https://api.inttegro.com by default.

Choose a client

AsyncInttegroClient is the default shown in new integration examples. Use it in FastAPI, Starlette, Quart, async Django views, Python Workers, and other event-loop applications. Its HTTP requests are non-blocking and share one connection pool:

import os

from inttegro import AsyncInttegroClient

async with AsyncInttegroClient(api_key=os.environ["INTTEGRO_API_KEY"]) as client:
    order = await client.orders.lookup("or_...")

Create one long-lived client during application startup and call aclose() during shutdown. An async with block is useful for scripts and jobs. Every resource operation on the async client is awaited.

Use InttegroClient in synchronous Django views, Flask, command-line tools, or other code without an event loop:

import os

from inttegro import InttegroClient

client = InttegroClient(api_key=os.environ["INTTEGRO_API_KEY"])
order = client.orders.lookup("or_...")

The two clients expose the same resources, request types, returned domain models, errors, idempotency behavior, and telemetry contract. Do not call the synchronous client directly from an async request handler because it blocks the event loop. The distinct class names make the concurrency model explicit: choose AsyncInttegroClient for an event loop and InttegroClient for a genuinely synchronous application.

Create a hosted checkout

Create and finalize an order, then send the customer to its hosted invoice URL:

import os

import inttegro
from inttegro import APIError, customer, money, order, price, product

async def create_checkout() -> str:
    request = order.CreateNewCustomerInput(
        request_meta=order.CreateNewCustomerInputRequestMeta(
            idempotency_key="checkout-cart-123",
        ),
        customer_data=customer.DataInput(
            name="Akua Mensah",
            email_address="akua@example.com",
            phone_number="+233544998605",
        ),
        finalize=True,
        checkout_settings=order.CreateNewCustomerInputCheckoutSettings(
            redirect_url="https://example.com/orders/complete",
            cancel_url="https://example.com/cart",
        ),
        line_items=[
            product.LineItemInput(
                type=order.LineItemType.PRODUCT,
                product=product.InlineDetailsInput(
                    type=product.Type.DIGITAL,
                    name="Monthly subscription",
                    quantity=1,
                    price=price.InlineParams(currency=money.Currency.GHS, value=5000),
                ),
            ),
        ],
    )
    try:
        async with inttegro.AsyncInttegroClient(
            api_key=os.environ["INTTEGRO_API_KEY"],
        ) as client:
            order = await client.orders.create(request)
            return order.invoice.format.web.url
    except APIError as error:
        print(error.code, error.detail or str(error))
        raise

Amounts use integer minor units: 5000 GHS is GHS 50.00. Reuse the same idempotency key when retrying the same logical write. If you omit one, the SDK generates a UUIDv7 key for mutating calls.

Observe SDK operations

The SDK emits vendor-neutral OpenTelemetry spans through your application's provider. It never configures an exporter or sends telemetry by itself. Configure OpenTelemetry at application startup; the global provider is used automatically, or pass tracer_provider explicitly:

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

Spans are named after logical operations such as inttegro.orders.create. HTTP attempts, response receipt, and decoding are span events. API keys, bodies, resource IDs, dynamic URLs, and exception messages are never recorded. See SDK observability for the complete contract and set telemetry_enabled=False when needed.

Report SDK failures

Provide an application-owned reporter to receive one immutable, typed, privacy-safe report after an SDK operation finally fails. The default "unexpected" policy reports transport, timeout, decoding, SDK, unknown_error, and server-side failures while leaving normal 4xx API errors alone:

client = inttegro.InttegroClient(
    api_key=os.environ["INTTEGRO_API_KEY"],
    error_reporter=error_collector.enqueue,
)

Use error_reporting_policy="all" to include expected API failures; cancellations are never reported. Call report.to_dict() when a collector needs a JSON-serializable value. Reports contain the logical operation, static route, server host, status and request IDs when available, duration, safe API error codes, SDK identity, stable fingerprint, exception type, and trace IDs when tracing is active. They exclude credentials, headers, bodies, resource IDs, dynamic URLs, exception messages, and stack traces. Reporter failures are isolated and the original SDK error is still raised.

Error reporting is completely opt-in. Without error_reporter, the SDK does not calculate report metadata, create an event ID or timestamp, allocate a report, or serialize a payload.

Work with the API

The SDK covers orders and checkout, customers, products and prices, purchase intents, payment methods, balances, payouts and refunds, notifications, files, application settings, keys, and country specifications. Resources use snake-case attributes such as purchase_intents and payment_methods.

Python-specific features:

  • Native async HTTP transport powered by HTTPX, plus a dependency-light synchronous standard-library transport.
  • OpenAPI-generated, immutable request and domain dataclasses with fully typed nested fields.
  • Singular resource namespaces keep the public API navigable: inttegro.product.Product, inttegro.payment.Payment, and inttegro.order.CreateRequest.
  • Mapping-style lookup and to_dict() conversion on every returned domain object.
  • Dictionary request payloads remain available when an integration cannot construct typed request objects.
  • JSON-compatible string enums for public API values.
  • Configurable timeout, base URL, and injectable transport for tests or custom networking.
  • Structured authentication, rate-limit, network, timeout, and API exceptions.

The namespace name identifies the resource and its same-named class is the primary returned object. Related request objects, nested shapes, and enums live beside it, so editors and code-reading agents can discover the full surface without searching a monolithic model module:

from inttegro import payment, product

def summarize(value: payment.Payment) -> str:
    if value.requires_action():
        return "customer action required"
    return f"{value.status}: {value.amount.value} {value.amount.currency.value.upper()}"

item: product.Product

Request and returned domain fields are available to editors, Pyright, and mypy without plugins:

import os

import inttegro
from inttegro import money, refund

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

request = refund.CreateRequest(
    order_id="or_0123456789abcdefghijklmnopqrstuvwxyzABCD",
    reason=refund.Reason.REQUESTED_BY_CUSTOMER,
    line_items=[
        refund.CreateLineItemInput(
            order_line_item_id="oli_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN",
            refund_amount=money.AmountParams(currency=money.Currency.GHS, value=2500),
        ),
    ],
)

created_refund: refund.Refund = await client.refunds.create(request)
print(created_refund.id, created_refund.total.value)

See the API reference for request fields and lifecycle rules, errors for recovery guidance, and idempotency for safe retries.

Verify a release

The GitHub release for each version is the canonical record. It contains the exact wheel and source distribution uploaded to PyPI, SHA-256 checksums, and a Sigstore attestation tied to the source commit and release workflow.

sha256sum --check SHA256SUMS
gh attestation verify inttegro-7.0.0-py3-none-any.whl \
  --repo inttegro/inttegro-sdk-python

Develop

poetry install
poetry run python scripts/generate_async_resources.py --check
poetry run python -m unittest discover -s tests -p "test_*.py"
poetry run mypy src
poetry run pyright

Metadata

Release files for inttegro 14.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inttegro 14.1.0
File Size Uploaded Provenance Actions
inttegro-14.1.0.tar.gz 227.5 kB With provenance Details for inttegro-14.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for inttegro 14.1.0
File Interpreter ABI Platform Actions
inttegro-14.1.0-py3-none-any.whl Python 3 none any Details for inttegro-14.1.0-py3-none-any.whl

Total release size: 937.8 kB

Release files / inttegro-14.1.0.tar.gz

Download URL inttegro-14.1.0.tar.gz
Size 227.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fb4204d16511098c44820a99873ea9dda7d6798ced08547fbf123707e7c14d8b
BLAKE2b-256 checksum
How to use checksums
fc12956a828f70cecd09175dc39968d5b994a1f1e524203642cb7cc595805c95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / inttegro-14.1.0-py3-none-any.whl

Download URL inttegro-14.1.0-py3-none-any.whl
Size 710.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bdf53b6ae0512b861b35b8c951299907c5df58ef3a84e95989e527fbd460b3c8
BLAKE2b-256 checksum
How to use checksums
1ee9b5381e06c8b2ae3d5948fbd89edce057416375786c35f13b2bf9af7f7398
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Security for inttegro 14.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for inttegro-14.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

14.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page