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, 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.

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.0.tar.gz (58.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_core-3.0.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_getpaid_core-3.0.0.tar.gz
  • Upload date:
  • Size: 58.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for python_getpaid_core-3.0.0.tar.gz
Algorithm Hash digest
SHA256 e8e0c1425c599f8a0af5286f966306399413be8e534a476c49f57c049538ad4b
MD5 4ace8941989896284a8e072391960bf9
BLAKE2b-256 e6b161581d17c2fa84cd3e8e5f21379f16d8a94f0d5b9a5ee3877bab4a4fd23d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_getpaid_core-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2cdfe0508e78c03d05abdba1ebddd4464767e8225ecaf45ed6f317208c65c99
MD5 dab4e60d056735afad119ff9b889b2de
BLAKE2b-256 05bd31181a55db9d0467bd3e21b5b9496af44eae9d8d7c4c0add537e8de02c03

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