Skip to main content

Agentic Checkout surface for Sardis - PSP routing and orchestration

Project description

Sardis Checkout Surface

Agentic Checkout - PSP routing and orchestration layer for Sardis.

This package provides the checkout surface that routes agent payments to existing PSPs (Stripe, PayPal, Coinbase, Circle) while leveraging the core Agent Wallet OS for policy enforcement and mandate verification.


Architecture

Agent Checkout Request
         │
         ▼
┌─────────────────────────────────────┐
│   Agent Wallet OS (Core)            │
│   - Policy Check                    │
│   - Mandate Verification            │
│   - Agent Identity                  │
└──────────────┬──────────────────────┘
               │
               ▼
┌─────────────────────────────────────┐
│   Checkout Orchestrator             │
│   - PSP Selection                   │
│   - Session Management              │
└──────────────┬──────────────────────┘
               │
        ┌──────┴──────┐
        │             │
        ▼             ▼
┌──────────┐   ┌──────────┐
│ Stripe   │   │ PayPal   │
│ Connector│   │ Connector│
└──────────┘   └──────────┘

Features

  • Multi-PSP Support: Route to Stripe, PayPal, Coinbase, Circle
  • Policy-Based Routing: Uses core policy engine for approval
  • Checkout Sessions: Create and manage checkout sessions
  • Webhook Handling: Process PSP webhooks
  • Merchant Dashboard: Analytics and configuration

Installation

pip install sardis-checkout

Usage

Basic Checkout Flow

from sardis_checkout import CheckoutOrchestrator
from sardis_checkout.connectors import StripeConnector

# Initialize orchestrator
orchestrator = CheckoutOrchestrator(
    stripe_connector=StripeConnector(api_key="sk_..."),
)

# Create checkout session
session = await orchestrator.create_checkout_session(
    agent_id="agent_123",
    merchant_id="merchant_456",
    amount=Decimal("100.00"),
    currency="USD",
    metadata={"order_id": "order_789"},
)

# Get checkout URL
print(session.checkout_url)  # https://checkout.stripe.com/...

PSP Selection

# Orchestrator automatically selects PSP based on:
# 1. Merchant preference
# 2. Agent policy constraints
# 3. PSP availability

psp = await orchestrator.select_psp(
    merchant_id="merchant_456",
    agent_id="agent_123",
    amount=Decimal("100.00"),
)

Webhook Handling

from sardis_checkout.webhooks import handle_stripe_webhook

# Handle Stripe webhook
event = await handle_stripe_webhook(
    payload=request.body,
    signature=request.headers["stripe-signature"],
    secret=stripe_webhook_secret,
)

if event.type == "checkout.session.completed":
    # Update ledger, emit webhook, etc.
    await process_payment_completion(event.data)

Connectors

Stripe

from sardis_checkout.connectors.stripe import StripeConnector

connector = StripeConnector(
    api_key="sk_test_...",
    webhook_secret="whsec_...",
)

session = await connector.create_checkout_session(
    amount=Decimal("100.00"),
    currency="USD",
    agent_id="agent_123",
    metadata={},
)

PayPal (Coming Soon)

from sardis_checkout.connectors.paypal import PayPalConnector

connector = PayPalConnector(
    client_id="...",
    client_secret="...",
)

Coinbase Commerce (Coming Soon)

from sardis_checkout.connectors.coinbase import CoinbaseConnector

connector = CoinbaseConnector(
    api_key="...",
)

API Integration

FastAPI Router

from sardis_checkout.api import create_checkout_router

app.include_router(
    create_checkout_router(orchestrator),
    prefix="/api/v2/checkout",
    tags=["checkout"],
)

Endpoints

  • POST /checkout/create - Create checkout session
  • GET /checkout/{id} - Get checkout status
  • POST /checkout/{id}/complete - Complete checkout
  • POST /checkout/webhooks/{psp} - PSP webhook handler

Development

# Install dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Type check
mypy src/

# Lint
ruff check src/

License

Proprietary - All rights reserved.

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

sardis_checkout-0.1.0.tar.gz (46.8 kB view details)

Uploaded Source

Built Distribution

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

sardis_checkout-0.1.0-py3-none-any.whl (51.2 kB view details)

Uploaded Python 3

File details

Details for the file sardis_checkout-0.1.0.tar.gz.

File metadata

  • Download URL: sardis_checkout-0.1.0.tar.gz
  • Upload date:
  • Size: 46.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for sardis_checkout-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2a2e941d5a8547adfb1985b263bf24275370aa443fc8c0dfeaa9fedf99975313
MD5 4768acb3cd62d9384f798636a4c7293f
BLAKE2b-256 a57505164c369d1fdd25ff5e81d57e12e6b3351b7a0df8821142b8f8a39ecbb2

See more details on using hashes here.

File details

Details for the file sardis_checkout-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sardis_checkout-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aebd56629bc309bb844758d34eb2ddc93200cf21e2ce984fab0d8b672b1265bc
MD5 4931902628a914f4af3684b5c07e0874
BLAKE2b-256 acb00f42449fc3fc8728ca761f6019ea2f67e5c1d0b08748abcaf798f55547a8

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