Skip to main content

Square billing provider for the Swarmauri SDK.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_billing_square


Swarmauri Billing Square

The Swarmauri Billing Square package delivers a Square-backed billing provider that speaks the Swarmauri billing interfaces. It uses the official Square Python SDK to manage catalog items, hosted checkout links, card-not-present payments, subscriptions, and invoices.

Features

  • ✅ Turns Square catalog items and variations into Swarmauri product and price references.
  • ✅ Generates hosted checkout links through the Payments API Link service.
  • ✅ Supports payment intents, captures, and cancellations using Square's server APIs.
  • ✅ Manages subscriptions and invoices, including publishing and cancellation flows.
  • ✅ Surfaces marketplace fee splits and dispute listings for downstream automation.

Installation

pip install swarmauri_billing_square
uv add swarmauri_billing_square

Usage

from swarmauri_billing_square import SquareBillingProvider
from swarmauri_base.billing import CheckoutRequest, PriceSpec, ProductSpec

provider = SquareBillingProvider(
    access_token="sq0atp-...",
    location_id="L8899XYZ",
)

product = provider.create_product(
    ProductSpec(name="Digital Membership", description="Premium access"),
    idempotency_key="prod-square-001",
)

price = provider.create_price(
    product,
    PriceSpec(currency="USD", unit_amount_minor=2500, nickname="Monthly"),
    idempotency_key="price-square-001",
)

checkout = provider.create_checkout(
    price,
    CheckoutRequest(
        quantity=1,
        success_url="https://merchant.example/success",
        cancel_url="https://merchant.example/cancel",
        idempotency_key="checkout-square-001",
    ),
)

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

Capability Mapping

Square capabilities advertised by this provider map to swarmauri_core.billing.Capability. Use capabilities_to_tigrbl to translate capabilities to the tigrbl billing vocabulary when required.

Contributing

Community improvements are welcome! Enhancements that broaden Square API coverage or harden error handling are greatly appreciated.

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_square-0.9.2.tar.gz (9.5 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_square-0.9.2-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_billing_square-0.9.2.tar.gz.

File metadata

  • Download URL: swarmauri_billing_square-0.9.2.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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_square-0.9.2.tar.gz
Algorithm Hash digest
SHA256 0c1cb58e428aef38ca8a1a538d2adef429c9a692b93230f03bd896901f6dc8d4
MD5 d62083ac50afdc6cb06f48ac1253a8cd
BLAKE2b-256 ef838f305e7047e4fa5c8a501eb8af71bb8fbf512f433e36d9e95c688598851d

See more details on using hashes here.

File details

Details for the file swarmauri_billing_square-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_billing_square-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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_square-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eb4686679773553b57c5c3a935c2b34a78a7cbf4ce76a345592433b95ef6ac34
MD5 3d035f00771f76ef16283c7889aa786e
BLAKE2b-256 6121677f1f072f0c4a78b2d91bbfd5fc9bb43a53e434d81f97fc010f2e667451

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