Skip to main content

python-getpaid-paynow

PyPI version License: MIT Python versions

Paynow payment processor for python-getpaid ecosystem. Paynow is a modern Polish payment provider and a subsidiary of mBank.

Architecture

The plugin is split into two layers:

  • PaynowClient -- low-level async HTTP client wrapping the Paynow V3 REST API. Uses httpx.AsyncClient with API Key authentication and HMAC-SHA256 request signing. Can be used standalone or as an async context manager for connection reuse.
  • PaynowProcessor -- high-level payment processor implementing BaseProcessor. Orchestrates payment creation, callback/notification handling, status polling, and refunds using semantic payment updates.

Key Features

  • Create payment -- register a payment and get a redirect URL
  • Notification handling -- verify HMAC-SHA256 signature and process status changes
  • Status polling -- fetch current payment status via API (PULL flow)
  • Refund -- create, check, and cancel refunds
  • Payment methods -- retrieve available payment methods
  • Sandbox mode -- full support for testing environment

Note: Paynow does not support pre-authorization flows. Immediate capture is used for all transactions. The charge() and release_lock() methods raise NotImplementedError.

Supported Currencies

The processor supports the following 4 currencies:

  • PLN (Polish Złoty)
  • EUR (Euro)
  • GBP (British Pound)
  • USD (US Dollar)

Installation

Install the package using pip:

pip install python-getpaid-paynow

Install simulator support only when you want this package to register its local simulator plugin with python-getpaid-simulator:

pip install python-getpaid-paynow[simulator]

This extra installs the simulator host and Litestar dependencies, then exposes the paynow plugin through the getpaid.simulator.providers entry point.

Simulator Plugin

When python-getpaid-paynow[simulator] is installed alongside python-getpaid-simulator, the simulator host auto-discovers the PayNow plugin.

Typical local setup:

pip install python-getpaid-simulator python-getpaid-paynow[simulator]
getpaid-simulator

The plugin contributes:

  • PayNow payment and refund simulator API routes under /paynow/v3/...
  • PayNow authorization UI at /sim/paynow/authorize/{payment_id}
  • PayNow-specific webhook signing and state transitions

Useful simulator environment variables:

  • SIMULATOR_PAYNOW_API_KEY
  • SIMULATOR_PAYNOW_SIGNATURE_KEY
  • SIMULATOR_PAYNOW_NOTIFY_URL
  • SIMULATOR_PLUGIN_FAILURE_MODE (warn or strict)

Quick Usage

Standalone Client

import anyio
from decimal import Decimal
from getpaid_paynow import PaynowClient

async def main():
    async with PaynowClient(
        api_key="your-api-key",
        signature_key="your-signature-key",
        api_url="https://api.sandbox.paynow.pl",
    ) as client:
        # Create a payment
        response = await client.create_payment(
            amount=Decimal("49.99"),
            currency="PLN",
            external_id="order-001",
            description="Order #001",
            buyer_email="buyer@example.com",
            continue_url="https://shop.example.com/return/order-001",
        )
        redirect_url = response["redirectUrl"]
        print(f"Redirect buyer to: {redirect_url}")

anyio.run(main)

With python-getpaid

Register the plugin via entry point in pyproject.toml (if not using the pre-packaged version):

[project.entry-points."getpaid.backends"]
paynow = "getpaid_paynow.processor:PaynowProcessor"

Then configure in your project settings:

GETPAID_BACKEND_SETTINGS = {
    "paynow": {
        "api_key": "your-api-key",
        "signature_key": "your-signature-key",
        "sandbox": True,
        "notification_url": "https://your-site.com/payments/{payment_id}/callback/",
        "continue_url": "https://your-site.com/payments/{payment_id}/return/",
    }
}

Configuration Reference

Key Type Default Description
api_key str required API key from Paynow merchant panel
signature_key str required Signature key for HMAC calculation
sandbox bool True Use sandbox or production API
notification_url str "" Notification URL template; use {payment_id} placeholder
continue_url str "" Return URL template; use {payment_id} placeholder

Requirements

  • Python 3.12+
  • python-getpaid-core >= 3.0.0
  • httpx >= 0.27.0

Links

License

This project is licensed under the MIT License.

Credits

Created by Dominik Kozaczko.

Metadata

Release files for python-getpaid-paynow 3.2.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 python-getpaid-paynow 3.2.0
File Size Uploaded
python_getpaid_paynow-3.2.0.tar.gz 121.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-getpaid-paynow 3.2.0
File Interpreter ABI Platform
python_getpaid_paynow-3.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 141.6 kB

Release files / python_getpaid_paynow-3.2.0.tar.gz

Download URL python_getpaid_paynow-3.2.0.tar.gz
Size 121.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1eee2d8be589182cb0a7f9ddd9612e35a300f587117a2e188d3bfdef9510a343
BLAKE2b-256 checksum
How to use checksums
0384bf3b4d509dd3a2c19ec82cc61306787f4a110f7a840f6ce32ca7d7b81135
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / python_getpaid_paynow-3.2.0-py3-none-any.whl

Download URL python_getpaid_paynow-3.2.0-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
56fcd0f36f023d0fdfa89a90ca410ceec36c071e12e29f8bc6ec481c5a8aa92c
BLAKE2b-256 checksum
How to use checksums
bae7d11db5056d7ecc9dbe8a171a32e82ad65343e105887f351d27ceb3b1f67a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12
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