Skip to main content

Przelewy24 payment gateway integration for python-getpaid ecosystem.

Project description

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.0a4
  • httpx >= 0.27.0

License

This project is licensed under the MIT License.

Links


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

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_przelewy24-3.0.0a4.tar.gz (23.1 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_przelewy24-3.0.0a4-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file python_getpaid_przelewy24-3.0.0a4.tar.gz.

File metadata

  • Download URL: python_getpaid_przelewy24-3.0.0a4.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","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_przelewy24-3.0.0a4.tar.gz
Algorithm Hash digest
SHA256 e2ea2dec090cfcdf1be92713a0a08760c39921f7043777521f9281f4fb0471cb
MD5 d030fabdd44f096b289c5bfa71f295ea
BLAKE2b-256 b3c85fb3d217af84ba3dd79a992abc3a689d4fefcefc4068b20c07a9aa022072

See more details on using hashes here.

File details

Details for the file python_getpaid_przelewy24-3.0.0a4-py3-none-any.whl.

File metadata

  • Download URL: python_getpaid_przelewy24-3.0.0a4-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","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_przelewy24-3.0.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 ec62a1809af526c21ac12280ec88e30f1d3a0c7cfd9bbbc6f05bcc57a5796954
MD5 45f672e395c334286a8aec0a05e18c88
BLAKE2b-256 d0ad0f4e75e2bf7cc042ddab81e67840dcc7b04342bde0d5815f4f22b817baa9

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