Skip to main content

Paynow payment gateway integration for python-getpaid ecosystem.

Project description

getpaid-paynow

PyPI Python Version License

Paynow payment gateway plugin for the python-getpaid ecosystem. Provides an async HTTP client (PaynowClient) and a payment processor (PaynowProcessor) that integrates with getpaid-core's BaseProcessor interface. Authentication uses API Key + HMAC-SHA256 signature against the Paynow V3 REST API.

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. Integrates with the getpaid-core FSM for state transitions.

Key Features

  • Create payment -- register a payment and get a redirect URL
  • Notification handling -- verify HMAC signature and process status changes
  • Status polling -- fetch current payment status via API
  • Refund -- create, check, and cancel refunds
  • Payment methods -- retrieve available payment methods
  • HMAC-SHA256 signatures -- automatic request and notification signing
  • PUSH and PULL -- notification-based flow with optional status polling

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 django-getpaid

Register the plugin via entry point in pyproject.toml:

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

Then configure in your Django settings (or config dict):

GETPAID_BACKEND_SETTINGS = {
    "paynow": {
        "api_key": "your-api-key",
        "signature_key": "your-signature-key",
        "sandbox": True,
        "notification_url": "https://shop.example.com/payments/{payment_id}/callback/",
        "continue_url": "https://shop.example.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

Supported Currencies

PLN, EUR, USD, GBP (4 total).

Limitations

Paynow does not support pre-authorization. The charge() and release_lock() methods raise NotImplementedError.

Requirements

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

Related Projects

License

MIT

Disclaimer

This project has nothing in common with the getpaid plone project. It is part of the django-getpaid / python-getpaid ecosystem.

Credits

Created by Dominik Kozaczko.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_getpaid_paynow-0.1.2.tar.gz (65.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_getpaid_paynow-0.1.2-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file python_getpaid_paynow-0.1.2.tar.gz.

File metadata

  • Download URL: python_getpaid_paynow-0.1.2.tar.gz
  • Upload date:
  • Size: 65.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Manjaro Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for python_getpaid_paynow-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a179336fda615b90f583413205fada66cab61302abd1d20474323f6d821e2d3d
MD5 56544d5d8c8d40899f730894f9998df8
BLAKE2b-256 0b7baa63c9ca4ddf1a0874f0b0dfc0ae3010f143a8a688a10095514938602c8e

See more details on using hashes here.

File details

Details for the file python_getpaid_paynow-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: python_getpaid_paynow-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Manjaro Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for python_getpaid_paynow-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c7ca04e392b8f69903367092b57131c27cfe269f6c83be01f2ae0ab10c39e93a
MD5 32e1c919162123b6592d64ed7a57478b
BLAKE2b-256 46acf7b4517a558862c21631a309e02676e1d18ccd551f7dfc99bd675b4e3404

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page