Skip to main content

PayU payment gateway integration for python-getpaid ecosystem.

Project description

getpaid-payu

PyPI Python Version License

PayU payment gateway plugin for the python-getpaid ecosystem. Provides a fully async HTTP client (PayUClient) and a payment processor (PayUProcessor) implementing the getpaid-core BaseProcessor interface. Communicates with PayU via their REST API v2.1 using OAuth2 authentication.

Architecture

getpaid-payu is composed of two main layers:

  • PayUClient — a low-level async HTTP client (built on httpx) that wraps every PayU REST API v2.1 endpoint. OAuth2 tokens are obtained lazily and refreshed automatically. Can be used as an async context manager for connection reuse.
  • PayUProcessor — a high-level processor that implements BaseProcessor from getpaid-core. Translates between the core payment protocol and PayU's API, handles signature verification, PUSH/PULL callbacks, and FSM transitions.

Key Features

  • Full PayU REST API v2.1 coverage
  • Async HTTP client with automatic OAuth2 token management
  • Create order, cancel, capture (charge), retrieve order info
  • Refund operations: create, retrieve single, retrieve all
  • Payment methods retrieval
  • Transaction details retrieval
  • Shop info and payout operations
  • Token deletion (card-on-file)
  • Automatic amount centification (amounts × 100) and normalization
  • Signature verification (MD5 and SHA-256)
  • PUSH callback handling with FSM integration
  • PULL status polling
  • Full pre-authorization support (lock, charge, release)

Quick Usage

PayUClient can be used standalone as an async context manager:

from decimal import Decimal
from getpaid_payu.client import PayUClient
from getpaid_payu.types import Currency

async with PayUClient(
    api_url="https://secure.snd.payu.com/",
    pos_id=300746,
    second_key="b6ca15b0d1020e8094f2b...",
    oauth_id=300746,
    oauth_secret="2ee86a66e5d97e3fadc4...",
) as client:
    response = await client.new_order(
        amount=Decimal("29.99"),
        currency=Currency.PLN,
        order_id="order-123",
        description="Test order",
    )
    redirect_url = response["redirectUri"]

Configuration

When used via a framework adapter (e.g. django-getpaid), configuration is provided as a dictionary:

Key Type Default Description
pos_id int PayU POS (point of sale) identifier
second_key str Second key (MD5) from PayU panel, used for signature verification
oauth_id int OAuth client ID from PayU panel
oauth_secret str OAuth client secret from PayU panel
sandbox bool True Use sandbox (secure.snd.payu.com) or production (secure.payu.com)
notify_url str None Notification callback URL template, e.g. https://example.com/payments/{payment_id}/notify
continue_url str None Redirect URL template after payment, e.g. https://example.com/payments/{payment_id}/continue

Example configuration dict:

GETPAID_BACKENDS = {
    "payu": {
        "pos_id": 300746,
        "second_key": "b6ca15b0d1020e8094f2b...",
        "oauth_id": 300746,
        "oauth_secret": "2ee86a66e5d97e3fadc4...",
        "sandbox": True,
        "notify_url": "https://example.com/payments/{payment_id}/notify",
        "continue_url": "https://example.com/payments/{payment_id}/continue",
    }
}

Supported Currencies

BGN, CHF, CZK, DKK, EUR, GBP, HRK, HUF, NOK, PLN, RON, RUB, SEK, UAH, USD

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.

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_payu-0.1.0.tar.gz (69.4 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_payu-0.1.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file python_getpaid_payu-0.1.0.tar.gz.

File metadata

  • Download URL: python_getpaid_payu-0.1.0.tar.gz
  • Upload date:
  • Size: 69.4 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_payu-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7f64181eabdfad52df3e3e0ad9d6faa092ad835e46461cd1578145d5406dad7c
MD5 e14bf1d0e92f0dca8307343742c6fcac
BLAKE2b-256 6ab89cd5bc6e28b37477d6af68255ac5be939a115b9d2543cfddf8069208581e

See more details on using hashes here.

File details

Details for the file python_getpaid_payu-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: python_getpaid_payu-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.1 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_payu-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ebd6952716a56e7f0340732f4ea4d94199de58ca3fcdf04365ba55340bcd1381
MD5 c52c1dfbf79bdebc3eeb90d7d287b52f
BLAKE2b-256 8f9c6f1a3f592a73cee16f4c747e8704dfd51823f2e2ebfc97e5120ac8ae213f

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