Skip to main content

python-getpaid-core

PyPI version Python version License

Framework-agnostic payment processing core.

python-getpaid-core is the foundation of the Getpaid ecosystem. It provides the abstract interfaces, semantic payment update engine, and plugin registry needed to build a robust payment system without coupling your logic to a specific web framework or payment provider.

Installation

pip install python-getpaid-core

Quick Start: Creating a Custom Processor

To implement a new payment backend, subclass BaseProcessor and implement at least prepare_transaction.

from getpaid_core import BaseProcessor
from getpaid_core.types import TransactionResult

class MyPaymentProcessor(BaseProcessor):
    slug = "my-provider"
    display_name = "My Payment Provider"
    accepted_currencies = ["USD", "EUR"]

    async def prepare_transaction(self, **kwargs) -> TransactionResult:
        # Generate payment link or form data
        return TransactionResult(
            redirect_url=f"https://api.provider.com/pay/{self.payment.id}",
            method="GET"
        )

Registering your Processor

Register your processor using entry points in your pyproject.toml so it can be discovered by the registry:

[project.entry-points."getpaid.backends"]
my-provider = "my_package.processors:MyPaymentProcessor"

Architecture Overview

  • BaseProcessor: The abstract base class that all payment gateway plugins must implement. It provides the standard interface for transaction preparation, callback handling, charging, and refunds.
  • PaymentFlow: Manages the payment lifecycle using semantic payment update objects. It ensures that payments move between states (e.g., NEW -> PREPARED -> PAID) according to strict business rules.
  • PluginRegistry: A central service for discovering and managing payment processors registered via getpaid.backends entry points.
  • State Engine: Applies semantic payment and fraud events to payment objects, merges provider metadata, and tracks idempotent provider event IDs.

API Summary

Class / Module Role
BaseProcessor Abstract base for implementing payment gateways.
PaymentFlow Semantic orchestration for payment lifecycles.
PaymentStatus Enum for all possible payment states (NEW, PAID, FAILED, etc.).
registry Singleton registry for backend discovery.
TransactionResult Standard response for transaction initiation.
GetPaidException Base exception for all payment-related errors.

Ecosystem

getpaid-core is the heart of a larger ecosystem designed to make payment processing easy in any Python web application.

Framework Wrappers

Processor Plugins

License

This project is licensed under the MIT License.

Metadata

Release files for python-getpaid-core 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-core 3.2.0
File Size Uploaded
python_getpaid_core-3.2.0.tar.gz 63.9 kB Details

Built distribution (wheel)

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

Total release size: 82.1 kB

Release files / python_getpaid_core-3.2.0.tar.gz

Download URL python_getpaid_core-3.2.0.tar.gz
Size 63.9 kB
Tags Source
SHA-256 checksum
How to use checksums
422a65217c4d37c5515d0fd98ee074908a5b40b167de46cb3836de6ea06de6b8
BLAKE2b-256 checksum
How to use checksums
53e4f754e6c49915fe261985b9ada9bd5153307c45c4f9163d9ba2618d9b0d3c
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_core-3.2.0-py3-none-any.whl

Download URL python_getpaid_core-3.2.0-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61cd25557306de26e6b369eae7c55072e5608267bde936749e30d57e0c5fc051
BLAKE2b-256 checksum
How to use checksums
10fc41555770dee19111f2c34fbcd7763d602923ba7a5fcb3b5633ff842b1e18
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