Skip to main content

PayPal REST backed Swarmauri billing provider for products, plans, orders, captures, refunds, subscriptions, invoices, payouts, disputes, and webhooks.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_billing_paypal Discord

Swarmauri Billing PayPal

swarmauri_billing_paypal provides a PayPal REST backed billing provider for Swarmauri checkout, payment, subscription, invoicing, refund, payout, reporting, dispute, and webhook workflows. It connects Swarmauri billing interfaces to PayPal products, billing plans, Checkout Orders, captures, authorisation voids, refunds, subscriptions, invoices, payouts, customer disputes, webhook signature verification, and webhook event parsing.

Why Swarmauri Billing PayPal?

swarmauri_billing_paypal lets Swarmauri billing workflows use PayPal REST APIs behind provider-neutral billing interfaces. Application code can create orders, capture payments, refund captures, send invoices, start payouts, verify webhook signatures, list customer disputes, and parse webhook events without hard-coding PayPal REST payloads throughout the codebase.

FAQ

Q: Does this package call live PayPal APIs?

A: Yes. It uses PayPal OAuth client credentials and calls PayPal REST endpoints for products, plans, orders, captures, voids, refunds, subscriptions, invoices, and payouts.

Q: Which Swarmauri billing capabilities does it cover?

A: It covers products, plan-like prices, hosted checkout orders, online orders, capture, authorization void, subscriptions, invoicing, refunds, payouts, customer dispute listing, PayPal webhook signature verification, and webhook event parsing. Customer, payment-method, balance, and report helpers remain compatibility placeholders where PayPal does not expose the same direct Swarmauri object shape.

Q: When should I use this package?

A: Use it for local billing workflows, provider strategy tests, documentation examples, and contract tests that need PayPal-style behavior through Swarmauri billing abstractions.

Features

  • PayPal provider class registered as PayPalBillingProvider.
  • OAuth client credentials authentication for sandbox or production.
  • Product and billing-plan creation.
  • Checkout Order creation with approval URL extraction.
  • Order capture and authorization void support.
  • Refund creation and lookup.
  • Subscription create/cancel support.
  • Invoice create/send/cancel support.
  • Payout batch creation.
  • Customer dispute listing through PayPal's customer disputes API.
  • PayPal webhook signature verification through PayPal's verification endpoint.
  • PayPal webhook JSON event parsing.
  • Python 3.10, 3.11, 3.12, 3.13, and 3.14 support.

Installation

Install with uv:

uv add swarmauri_billing_paypal

Install with pip:

pip install swarmauri_billing_paypal

Usage

Create a product, price, and PayPal-style checkout session:

from swarmauri_billing_paypal import PayPalBillingProvider
from swarmauri_base.billing import CheckoutRequest, PriceSpec, ProductSpec

provider = PayPalBillingProvider(
    api_key="paypal",
    client_id="paypal-client-id",
    client_secret="paypal-client-secret",
)

product = provider.create_product(
    ProductSpec(name="Workspace"),
    idempotency_key="paypal-prod-1",
)
price = provider.create_price(
    product,
    PriceSpec(currency="USD", unit_amount_minor=2500),
    idempotency_key="paypal-price-1",
)
checkout = provider.create_checkout(
    price,
    CheckoutRequest(success_url="https://example.com/return"),
)

print(product.id, price.id, checkout.url)

Create and capture a PayPal-style payment:

from swarmauri_billing_paypal import PayPalBillingProvider
from swarmauri_base.billing import PaymentIntentRequest

provider = PayPalBillingProvider(
    api_key="paypal",
    client_id="paypal-client-id",
    client_secret="paypal-client-secret",
)

payment = provider.create_payment_intent(
    PaymentIntentRequest(amount_minor=1500, currency="USD", confirm=True)
)
captured = provider.capture_payment(payment.id, idempotency_key="paypal-capture-1")

print(payment.status, captured.status)

Important Scope Notes

This package uses live PayPal REST API calls for products, plans, orders, captures, voids, refunds, subscriptions, invoices, payouts, customer disputes, webhook signature verification, and webhook parsing. Production use requires PayPal REST app credentials, correct sandbox or production environment selection, a configured PayPal webhook ID for signature verification, and account permissions for each enabled PayPal product.

Entry Point

The package exposes a Swarmauri billing provider entry point:

[project.entry-points.'swarmauri.billing_providers']
PayPalBillingProvider = "swarmauri_billing_paypal.provider:PayPalBillingProvider"

Related Packages

Billing provider packages:

Foundational packages:

  • swarmauri_core defines billing capabilities and interfaces.
  • swarmauri_base provides billing specs, refs, mixins, and BillingProviderBase.
  • swarmauri provides namespace imports and plugin discovery.

License

Apache-2.0

Contributing

If you connect this provider to live PayPal APIs, preserve deterministic tests, document required credentials and webhook behavior, and add coverage for each supported billing capability.

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

swarmauri_billing_paypal-0.11.0.dev1.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swarmauri_billing_paypal-0.11.0.dev1-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_billing_paypal-0.11.0.dev1.tar.gz.

File metadata

  • Download URL: swarmauri_billing_paypal-0.11.0.dev1.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_billing_paypal-0.11.0.dev1.tar.gz
Algorithm Hash digest
SHA256 de6e839d2b0e3a6fb53885ed00b26181637428b76e06028266ead316d00d8f45
MD5 6df592a7c3397797e8146cf34e4402c7
BLAKE2b-256 3ae7ce995481b4f3099a08520071ada4f0eb7203dd2c7033d4d3bbcef0d7f44a

See more details on using hashes here.

File details

Details for the file swarmauri_billing_paypal-0.11.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_billing_paypal-0.11.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_billing_paypal-0.11.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 dc93b5dcbd842a7f48f129e107f34fa41dc19039460b23bac417fe8acc2a0f99
MD5 c43183bcfadcb6175388ba43395bbca3
BLAKE2b-256 8ce2d7d9ebdee6edf3e785be1769e6dbfac27dc540b3ed8bf85f2d26af9451de

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