fastapi-getpaid
Multi-broker payment processing framework for FastAPI, built on getpaid-core.
v0.1.0 (Alpha) — This is a pre-release. The API may change before the stable v1.0 release.
Features
- Async-native from routes to persistence
- Multiple payment brokers at the same time
- Flexible plugin architecture via getpaid-core
- SQLAlchemy 2.0 async models and repository (optional)
- Webhook callback retry with exponential backoff
- Typed configuration via
pydantic-settingswith env var support - Plugin discovery and registration at startup
- REST endpoints for payment CRUD, callbacks, and redirects
Installation
pip install fastapi-getpaid
With SQLAlchemy support:
pip install fastapi-getpaid[sqlalchemy]
Or with uv:
uv add fastapi-getpaid
Then install a payment backend plugin (check that the plugin supports getpaid-core v3 before installing):
pip install python-getpaid-payu
Quick Start
from fastapi import FastAPI
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
from fastapi_getpaid.config import GetpaidConfig
from fastapi_getpaid.contrib.sqlalchemy.repository import (
SQLAlchemyPaymentRepository,
)
from fastapi_getpaid.contrib.sqlalchemy.retry_store import SQLAlchemyRetryStore
from fastapi_getpaid.router import create_payment_router
config = GetpaidConfig(
default_backend="dummy",
success_url="https://example.com/thank-you",
failure_url="https://example.com/payment-failed",
backends={
"dummy": {"module": "getpaid_core.backends.dummy"},
},
)
engine = create_async_engine("sqlite+aiosqlite:///payments.db")
session_factory = async_sessionmaker(engine, expire_on_commit=False)
repository = SQLAlchemyPaymentRepository(session_factory)
retry_store = SQLAlchemyRetryStore(session_factory)
payment_router = create_payment_router(
config=config,
repository=repository,
retry_store=retry_store,
)
app = FastAPI(title="My Payment Service")
app.include_router(payment_router, prefix="/api")
Start the server:
uvicorn myapp:app --reload
The payment endpoints will be available under /api/payments/.
See the example app for a fully working project with a built-in payment broker simulator.
Supported Versions
- Python: 3.12+
- FastAPI: 0.115+
- SQLAlchemy: 2.0+ (optional)
Running Tests
uv sync
uv run pytest
Or with ruff for linting:
uv run ruff check src/ tests/
Part of the getpaid ecosystem
This package is part of the getpaid family of libraries:
- python-getpaid-core — framework-agnostic payment processing core
- django-getpaid — Django integration
- fastapi-getpaid — FastAPI integration (this package)
Payment gateway plugins:
- python-getpaid-payu — PayU
- python-getpaid-paynow — mBank Paynow
- python-getpaid-przelewy24 — Przelewy24
Credits
Created by Dominik Kozaczko.
Disclaimer
This project has nothing in common with the getpaid plone project.
License
MIT
Metadata
Release files for fastapi-getpaid 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastapi_getpaid-0.1.2.tar.gz | 37.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastapi_getpaid-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 55.1 kB
Release files / fastapi_getpaid-0.1.2.tar.gz
| Download URL | fastapi_getpaid-0.1.2.tar.gz |
|---|---|
| Size | 37.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b540232d45788949c55ef7ec21243cafc09cfcc3b17383642eef5ad1b01caa2d
|
|
BLAKE2b-256 checksum How to use checksums |
e2521cdb58e1f3c76c0238757b42e988ff9ffdc9ef7b7b7067edd95344cfd747
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / fastapi_getpaid-0.1.2-py3-none-any.whl
| Download URL | fastapi_getpaid-0.1.2-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
845ae74e266c76bc29fba371ae7dfc706c0b7ce76344c8387548587412dbbbd9
|
|
BLAKE2b-256 checksum How to use checksums |
b3045e5277a3e98f753bd51391c3d0f8059c29ab8435b1a25ed8427d10fcf038
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|