Skip to main content

CertifiedData Agent Commerce Python SDK — provenance-aware payments for AI artifacts

Project description

certifieddata-agent-commerce

Python SDK for CertifiedData Agent Commerce — provenance-aware, policy-governed payments for AI agents and artifacts.

Install

pip install certifieddata-agent-commerce

Note: Install name is certifieddata-agent-commerce. Import name is certifieddata_agent_commerce (underscore, as required by Python naming conventions).

Quick start

from certifieddata_agent_commerce import CertifiedDataAgentCommerceClient

# Reads CDAC_API_KEY and CDAC_BASE_URL from environment automatically
client = CertifiedDataAgentCommerceClient()

# Phase 1 — agent declares intent
tx = client.transactions.create(
    amount=2500,       # cents ($25.00)
    currency="usd",
    rail="stripe",
)

# Phase 2 — attach provenance (binds AI decision record to payment)
client.transactions.attach_links(
    tx["id"],
    decision_record_id="dec_abc123",
)

# Phase 3+4 — capture: policy eval → settle → inline signed receipt
capture = client.transactions.capture(tx["id"])
receipt = capture["receipt"]

print(receipt["receipt_id"])
print(receipt["decision_record_id"])
print(receipt["sha256_hash"])
print(receipt["ed25519_sig"])

Configure

export CDAC_API_KEY=cdp_test_xxx
export CDAC_BASE_URL=https://sandbox.certifieddata.io  # omit for live
Environment Key prefix Base URL
Sandbox cdp_test_ https://sandbox.certifieddata.io
Live cdp_live_ https://certifieddata.io

Verify receipts publicly

Verification requires no API key:

curl https://certifieddata.io/api/payments/verify/<receipt_id>

Returns:

{
  "valid": true,
  "hashValid": true,
  "signatureValid": true,
  "signingKeyId": "cd_root_2026",
  "signatureAlg": "Ed25519"
}

Local development (mock server)

# Start mock server on port 3456
pip install flask
python examples/claude-demo/mock_server.py

# Run demo against mock
CDAC_API_KEY=cdp_test_any CDAC_BASE_URL=http://localhost:3456 \
  python examples/claude-demo/demo.py

Receipt shape

Every successful capture returns an inline signed receipt:

{
  "receipt_id": "rcpt_...",
  "transaction_id": "txn_...",
  "policy_id": "pol_...",
  "decision_record_id": "dec_...",
  "sha256_hash": "sha256:...",
  "ed25519_sig": "..."
}

decision_record_id is the canonical provenance field linking the payment to the AI decision that triggered it.

Package names

Context Name
pip install certifieddata-agent-commerce
import certifieddata_agent_commerce
Main class CertifiedDataAgentCommerceClient

Python requires hyphens in distribution names and underscores in import names — these are the same package, different naming conventions.

Resources

License

Apache-2.0

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

certifieddata_agent_commerce-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

certifieddata_agent_commerce-0.1.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for certifieddata_agent_commerce-0.1.0.tar.gz
Algorithm Hash digest
SHA256 40d8057996563429a7fa46e6c7b1030396bf673c3d7cfee83e3621caf70db9fd
MD5 27327a7c3634cae571a608cc03c46571
BLAKE2b-256 6f2954a0cf562d91a9c0890aad0805a9e5fc23d9c02f0987dab847cc1dd1e631

See more details on using hashes here.

Provenance

The following attestation bundles were made for certifieddata_agent_commerce-0.1.0.tar.gz:

Publisher: publish-python.yml on certifieddata/certifieddata-agent-commerce-public

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for certifieddata_agent_commerce-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4441c8296c804a412d866d40f9ace5c27dfd737cd238d4bb06352183c1c8fac4
MD5 383e79ccc4c01c46dd51dc7269ae690a
BLAKE2b-256 6ffe83443845b4b42819b16126f44b1bd9ae0a1bc2acc44817385d933e0f7940

See more details on using hashes here.

Provenance

The following attestation bundles were made for certifieddata_agent_commerce-0.1.0-py3-none-any.whl:

Publisher: publish-python.yml on certifieddata/certifieddata-agent-commerce-public

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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