Skip to main content

Rely Financials Python SDK

Server-side Python client for Rely Identity, organizations, branches and members, billing, wallet, transactions, inventory, and POS APIs. This package is released independently from the JavaScript SDK.

Install

pip install relyfinancials-sdk

Python 3.10 or newer is required.

For local development from this monorepo, install the package in editable mode:

python -m pip install -e ./packages/rely-sdk-python

Synchronous usage

from rely_sdk import Rely, RelyAPIError

with Rely(client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET") as rely:
    try:
        checkout = rely.checkout.create({
            "amount": "25.00",  # decimal string, with up to two decimal places
            "currency": "USD",
            "destination_wallet_id": "wallet-id",
            "success_url": "https://merchant.example/paid",
            "cancel_url": "https://merchant.example/cancelled",
            "webhook_url": "https://merchant.example/webhooks/rely",
            "order_id": "order-123",
        })
        print(checkout)
    except RelyAPIError as exc:
        print(exc.status, exc.code, exc.request_id, str(exc))

Asynchronous usage

from rely_sdk import AsyncRely

async with AsyncRely(client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET") as rely:
    checkout = await rely.checkout.create({
        "amount": "25.00",
        "currency": "USD",
        "destination_wallet_id": "wallet-id",
        "success_url": "https://merchant.example/paid",
        "cancel_url": "https://merchant.example/cancelled",
        "webhook_url": "https://merchant.example/webhooks/rely",
    })

AsyncRely uses HTTPX's asynchronous client. Every network operation returns an awaitable.

User and organization APIs

User and organization bearer tokens are passed explicitly to each method. Organization calls also take the organization ID first.

with Rely() as rely:
    organizations = rely.organizations.list(access_token)
    branches = rely.branches.list(organization_id, access_token)

    # Named API domains retain the HTTP verb and route from the Rely API.
    products = rely.inventory.list_products(
        organization_id,
        access_token,
        query={"page": 1, "page_size": 25},
    )
    sale = rely.pos.create_sale(
        organization_id,
        access_token,
        body={"items": [{"variant_id": "variant-id", "quantity": 1}]},
    )

The grouped namespaces include extensions, billing, wallet, transactions, user, inventory, and pos. For registry-backed methods, pass path values as keyword arguments, and pass query or JSON data as query= or body=. For example:

payment = rely.billing.payments.get_payment(access_token, payment_id="payment-id")
history = rely.wallet.get_history(access_token, query={"page": 1})
public_link = rely.billing.public.get_payment_link(token="public-token")

For a market POS scanner, send the decoded barcode as the code query value. The API resolves either a POS product or an inventory variant and returns the server-side price and stock details.

item = rely.pos.lookup_catalog(
    organization_id,
    access_token,
    query={"code": scanned_code, "branch_id": branch_id},
)

JSON payloads use the API's snake_case field names. Call signatures for specialized helpers such as checkout, organizations, branches, members, invitations, and SDK tokens are exposed directly on those clients.

Webhooks

Verify the signature against the exact raw request body before parsing or acting on an event. Do not parse and re-serialize the body before signature verification.

from rely_sdk import construct_webhook_event

event = construct_webhook_event(raw_body, signature, webhook_secret)
# Deduplicate on event["event_id"] before processing.

The standalone verify_webhook_signature(...) helper returns True for a valid HMAC-SHA256 signature. Invalid signatures and invalid JSON raise RelyWebhookSignatureError.

Configuration

Rely and AsyncRely accept client_id, client_secret, optional api_base_url and auth_base_url, timeout in seconds, max_retries, and retry_base in seconds. A single custom api_base_url is used for both gateways unless auth_base_url is also supplied. By default /v1/identity/* is routed to https://auth.relyfinancials.cloud; other API paths use https://api.relyfinancials.cloud.

Only GET requests are retried automatically (network errors, 429, and selected 5xx responses). Mutation calls are not retried to avoid duplicate charges or resource creation.

You can inject an existing httpx.Client or httpx.AsyncClient using http_client=. The SDK closes clients it creates itself; injected clients remain owned by the caller.

Publishing

The GitHub Actions workflow builds and publishes this directory when a tag matching rely-sdk-python-v* is pushed. For token-based publishing, create a PyPI API token scoped to relyfinancials-sdk, then save it as the PYPI_API_TOKEN secret in the GitHub pypi environment. The workflow reads it as a secret and never writes it to the repository.

Metadata

Release files for relyfinancials-sdk 0.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 relyfinancials-sdk 0.1.0
File Size Uploaded Provenance
relyfinancials_sdk-0.1.0.tar.gz 16.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for relyfinancials-sdk 0.1.0
File Interpreter ABI Platform
relyfinancials_sdk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.0 kB

Release files / relyfinancials_sdk-0.1.0.tar.gz

Download URL relyfinancials_sdk-0.1.0.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
523a34456ecadb37e6799ac389b466c50d384de73e312503eb5be8fc722238d3
BLAKE2b-256 checksum
How to use checksums
c945bd331b7769eee8020254b6b6392324c38e680f24e0d538bc438bfa4f5870
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / relyfinancials_sdk-0.1.0-py3-none-any.whl

Download URL relyfinancials_sdk-0.1.0-py3-none-any.whl
Size 16.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9376ad695be116e4eb6ececde6a9e9b8e253a93726c72d69b5d6f418f151f2e5
BLAKE2b-256 checksum
How to use checksums
aefefa78b0b6e36cae93b5cdc5c032896394af10f857c57b353ea1d1ab23e107
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Security for relyfinancials-sdk 0.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

0.1.0 This release

2 release files No 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