> ## Documentation Index
> Fetch the complete documentation index at: https://developers.uqpay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Python SDK

> Install and configure the official UQPAY Python SDK.

The UQPAY Python SDK provides typed access to Account Center, Global Account, Global Acquiring, Card Issuance, and Supporting Services. It includes automatic authentication, request retries, webhook verification, PGP authorization decisions, and sandbox transaction simulation.

<Card title="PyPI" icon="python" href="https://pypi.org/project/uqpay/">
  uqpay
</Card>

<Info>
  The SDK requires **Python 3.11** or later. Version **1.2.0** is its first release in the coordinated client release line.
</Info>

## Installation

```bash theme={null}
pip install uqpay
```

## Quick start

Before you begin, [create a sandbox account](/account-center/v1.6/guide/create-a-sandbox-account) and [create API keys](/account-center/v1.6/guide/create-api-keys).

<Tabs>
  <Tab title="Sandbox">
    ```python theme={null}
    from uqpay import UQPayClient

    client = UQPayClient(client_id="your-client-id", api_key="your-api-key", environment="sandbox")
    ```
  </Tab>

  <Tab title="Production">
    ```python theme={null}
    from uqpay import UQPayClient

    client = UQPayClient(client_id="your-client-id", api_key="your-api-key", environment="production")
    ```
  </Tab>
</Tabs>

## Configuration

```python theme={null}
client = UQPayClient(
    client_id="your-client-id",
    api_key="your-api-key",
    environment="sandbox",       # "sandbox" (default) or "production"
    timeout=30.0,                # request timeout in seconds
    max_retries=2,               # automatic retries on transient errors
    log_level="none",            # "none" | "error" | "warn" | "info" | "debug"
    redact_fields=["card_number", "cvc"],
)
```

You can also provide credentials through environment variables:

```bash theme={null}
export UQPAY_CLIENT_ID="your-client-id"
export UQPAY_API_KEY="your-api-key"
```

## Authentication

The SDK uses your `client_id` and `api_key` to retrieve a UQPAY Access Token, caches it, and retrieves a new Token before the current one expires. You do not need to manage Tokens manually.

<Note>
  Stablecoin Account (Ramp) is not included in the current SDK product scope.
</Note>

## Per-request options

Set idempotency, sub-account, timeout, and retry behavior for an individual request:

```python theme={null}
result = client.banking.payouts.create(
    {...},
    request_options={
        "idempotency_key": "unique-key",
        "on_behalf_of": "sub-account-id",
        "timeout": 60,
        "max_retries": 0,
    },
)
```

## Pagination

All list methods accept `page_number` and `page_size`:

```python theme={null}
page = 1
while True:
    result = client.issuing.cards.list({"page_number": page, "page_size": 50})
    items = result.get("items") or result.get("list") or []
    if not items:
        break
    for card in items:
        print(card["card_id"])
    page += 1
```

<CardGroup cols={2}>
  <Card title="Resources" icon="brackets-curly" href="/developer-tools/sdk/python/resources">
    Explore the available API namespaces.
  </Card>

  <Card title="Webhooks" icon="webhook" href="/developer-tools/sdk/python/webhooks">
    Verify incoming webhook signatures.
  </Card>

  <Card title="Authorization decision" icon="key" href="/developer-tools/sdk/python/authorization-decision">
    Handle PGP-encrypted card authorization decisions.
  </Card>

  <Card title="Error handling" icon="triangle-exclamation" href="/developer-tools/sdk/python/error-handling">
    Handle typed SDK errors and retries.
  </Card>
</CardGroup>
