Skip to main content

xpresspay

A Python SDK for integrating the Xpress payment gateway into your application.

Supports hosted payment page initialization and server-side payment verification. Built on httpx.

Full documentation

Requirements

  • Python 3.9+
  • uv (recommended) or pip

Installation

uv add xpresspay
# or
pip install xpresspay

Security

  • Your public key (XPPUBK-…) is sent as a Bearer token in every request.
  • Store credentials in environment variables, never in source code.

Quick start

from xpresspay import XpressPay

# Reads XPRESSPAY_PUBLIC_KEY from the environment automatically
client = XpressPay(sandbox=True)  # False for production

# Or pass the key explicitly
client = XpressPay(public_key="XPPUBK-...", sandbox=True)

Initialize a payment

from xpresspay import InitializeRequest

response = client.payments.initialize(
    InitializeRequest(
        amount="1000.00",
        email="customer@example.com",
        transaction_id="ORDER-001",
        callback_url="https://yourdomain.com/payment/callback",
    )
)

if response.is_successful:
    # Redirect the customer to the hosted payment page
    print(response.payment_url)
    print(response.reference)

Verify a payment (server-side)

Always verify server-side before fulfilling an order.

from xpresspay import VerifyRequest

result = client.payments.verify(
    VerifyRequest(transaction_id="ORDER-001")
)

if result.is_successful and result.amount == "1000.00":
    print("Payment confirmed:", result.gateway_response)
else:
    print("Not confirmed:", result.status)

Exception handling

from xpresspay import (
    XpressPayError,
    AuthenticationError,
    ValidationError,
    NetworkError,
)

try:
    response = client.payments.initialize(...)
except AuthenticationError:
    ...  # invalid / missing API key
except ValidationError as e:
    print(e.message, e.error_type)
except NetworkError:
    ...  # timeout — safe to retry
except XpressPayError:
    ...  # catch-all

Exception reference

Exception Trigger
XpressPayError Base class
AuthenticationError HTTP 401
ValidationError HTTP 400
NotFoundError HTTP 404
ProcessingError HTTP 5xx
NetworkError Timeout / connection error

Development

git clone https://github.com/praisegee/xpresspay
cd xpresspay
uv sync --group dev
uv run pytest
uv run ruff check xpresspay/ tests/

Environment variables

Variable Description
XPRESSPAY_PUBLIC_KEY Public key (XPPUBK-…) — picked up automatically if public_key is not passed to the client

License

Released under the MIT License.

Metadata

Release files for xpresspay 0.2.2

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

Source distribution (sdist)

Source distribution for xpresspay 0.2.2
File Size Uploaded Provenance Actions
xpresspay-0.2.2.tar.gz 73.7 kB With provenance Details for xpresspay-0.2.2.tar.gz

Built distribution (wheel)

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

Total release size: 83.3 kB

Release files / xpresspay-0.2.2.tar.gz

Download URL xpresspay-0.2.2.tar.gz
Size 73.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e17572cc583ccfed62fe807ed5ee4768709fabdd7bf13eb3167aebf4ba132964
BLAKE2b-256 checksum
How to use checksums
e7a3f6882cc09961d229c1cf1cb83bdbcfcfb856bd174c8de30000b656b62f73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Feb 22, 2026.

Transparency log

Release files / xpresspay-0.2.2-py3-none-any.whl

Download URL xpresspay-0.2.2-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b248a67fdab626d72d0c0bc6f43e601219e7444f294331598fdd1d8c90962a04
BLAKE2b-256 checksum
How to use checksums
b2d165d7eaf337278064a03347b0f79875863a4e8064a46d384887c1e4a5b0c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Feb 22, 2026.

Transparency log

Security for xpresspay 0.2.2

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for xpresspay-0.2.2.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 Feb 22, 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.

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