Skip to main content

python-getpaid-przelewy24

PyPI version License: MIT Python versions

Przelewy24 payment processor for the python-getpaid ecosystem.

Przelewy24 is a leading Polish payment service provider that supports a wide range of payment methods, including bank transfers (pay-by-link), credit cards, and e-wallets (BLIK, Google Pay, Apple Pay).

This package provides a clean, async-first integration with the Przelewy24 REST API v1.1, implementing the standard python-getpaid processor interface.

Features

  • Direct Payment Flow: Full implementation of the register -> redirect -> notification -> verify flow.
  • Secure by Default: Automatic signature verification (SHA-384) for all incoming notifications from Przelewy24.
  • Async-First: Built on top of httpx for efficient, non-blocking I/O.
  • Multi-Currency Support: PLN, EUR, GBP, USD, CZK, BGN, DKK, HUF, NOK, SEK, CHF, RON, HRK.
  • Sandbox Support: Easy switching between Sandbox and Production environments.
  • Payment Status Polling: Support for the PULL flow to check transaction status via API.
  • Refunds: Full support for processing refunds through the Przelewy24 API.
  • Semantic Updates: Integrates with python-getpaid-core semantic payment updates for robust payment state management.

Installation

Install the package using pip:

pip install python-getpaid-przelewy24

Or using uv:

uv add python-getpaid-przelewy24

Quick Start

Configuration

Add przelewy24 to your python-getpaid configuration. For example, in a Django project using django-getpaid:

GETPAID_BACKEND_SETTINGS = {
    "przelewy24": {
        "merchant_id": 12345,
        "pos_id": 12345,  # Usually the same as merchant_id
        "api_key": "your_api_key_here",
        "crc_key": "your_crc_key_here",
        "sandbox": True,  # Use True for testing, False for production
        "url_status": "https://your-domain.com/payments/p24/status/{payment_id}/",
        "url_return": "https://your-domain.com/payments/p24/return/{payment_id}/",
    }
}

Configuration Parameters

Key Type Description
merchant_id int Your Przelewy24 Merchant ID.
pos_id int Your Przelewy24 POS ID (defaults to merchant_id).
api_key str REST API Key from the Przelewy24 panel.
crc_key str CRC Key from the Przelewy24 panel (used for signing).
sandbox bool If True (default), uses the P24 Sandbox environment.
url_status str Callback URL for asynchronous notifications. Supports {payment_id}.
url_return str Return URL after payment completion. Supports {payment_id}.
refund_url_status str (Optional) Callback URL for refund status notifications.

Both url_status, url_return, and refund_url_status can include the {payment_id} placeholder, which will be automatically replaced with the actual payment ID.

Standalone Usage

While designed to work with python-getpaid framework wrappers, you can also use the P24Client directly:

import asyncio
from decimal import Decimal
from getpaid_przelewy24 import P24Client

async def main():
    async with P24Client(
        merchant_id=12345,
        pos_id=12345,
        api_key="your-api-key",
        crc_key="your-crc-key",
        sandbox=True,
    ) as client:
        # Register a transaction
        response = await client.register_transaction(
            session_id="order-001",
            amount=Decimal("49.99"),
            currency="PLN",
            description="Order #001",
            email="buyer@example.com",
            url_return="https://shop.example.com/return/",
            url_status="https://shop.example.com/callback/",
        )
        token = response["data"]["token"]
        print(f"Redirect URL: {client.get_transaction_redirect_url(token)}")

if __name__ == "__main__":
    asyncio.run(main())

Requirements

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

License

This project is licensed under the MIT License.

Links


Created by Dominik Kozaczko. Part of the python-getpaid ecosystem.

Metadata

Release files for python-getpaid-przelewy24 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-przelewy24 3.2.0
File Size Uploaded
python_getpaid_przelewy24-3.2.0.tar.gz 80.9 kB Details

Built distribution (wheel)

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

Total release size: 94.5 kB

Release files / python_getpaid_przelewy24-3.2.0.tar.gz

Download URL python_getpaid_przelewy24-3.2.0.tar.gz
Size 80.9 kB
Tags Source
SHA-256 checksum
How to use checksums
760c35205febc4a02e1b01adeaf83a2cfd21e4b6b9129996229a38d0023d8e59
BLAKE2b-256 checksum
How to use checksums
0c2625f7ad16d68e351b4a6409a1dedae64a08b09f9fd8d0a1734fec3efba679
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_przelewy24-3.2.0-py3-none-any.whl

Download URL python_getpaid_przelewy24-3.2.0-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
639936ffced7ce826105b29175eb1158e75235a92b4de8793b568985a6197857
BLAKE2b-256 checksum
How to use checksums
e13a3a9a8c061a74254d09bc861878e6eaedc091ad6080ef2fed06145c4a7260
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