Skip to main content

Framework-agnostic payment processing core.

Project description

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, finite state machines (FSM), 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 a Finite State Machine (FSM) powered by the transitions library. 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 Machine (FSM): Dynamically attaches state-machine triggers to payment objects at runtime, allowing for clean and predictable state transitions.

API Summary

Class / Module Role
BaseProcessor Abstract base for implementing payment gateways.
PaymentFlow FSM logic for managing 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.

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_core-3.0.0a2.tar.gz (93.2 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_core-3.0.0a2-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file python_getpaid_core-3.0.0a2.tar.gz.

File metadata

  • Download URL: python_getpaid_core-3.0.0a2.tar.gz
  • Upload date:
  • Size: 93.2 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_core-3.0.0a2.tar.gz
Algorithm Hash digest
SHA256 85707a7d9df8deca935fddd90fad8f7d4b53c54183d113286138d54bfa8bbd43
MD5 17cd9a22483e0eb5d34084062149be33
BLAKE2b-256 19396b161535961831698ee62b1af87d0e8730032b9fe082fe9714bc704dbb6d

See more details on using hashes here.

File details

Details for the file python_getpaid_core-3.0.0a2-py3-none-any.whl.

File metadata

  • Download URL: python_getpaid_core-3.0.0a2-py3-none-any.whl
  • Upload date:
  • Size: 14.0 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_core-3.0.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 b00894efe82102dc8241f2db05668772099c100baccd61de955110c728113f06
MD5 56c888db712522f9fdc15b8e089653e5
BLAKE2b-256 1f2a00fb5a8a3300c68971f52935837bf230d88a0221c4061f596182afd2f9ec

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