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

Get your keys at certifieddata.io/dashboard/cdp/api-keys.

export CDAC_API_KEY=cdp_test_xxx
# CDAC_BASE_URL defaults to https://certifieddata.io — omit unless using a local mock
Environment Key prefix Base URL
Test cdp_test_ https://certifieddata.io
Live cdp_live_ https://certifieddata.io

Both environments route through the same host. The key prefix controls which environment is active.

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.1.tar.gz (7.5 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.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for certifieddata_agent_commerce-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e81d81cae5e4d868bdc0b94d530403cbd87ab059457be10ed8517554b397c2fe
MD5 6f458000228c37ccf0b720a5e74cffe4
BLAKE2b-256 2a9617cb3fba68668e570d51d97d63ddfb92f3c1dd398ff8278a420f0622922d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for certifieddata_agent_commerce-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b047bdc4309025bf5352068a4a5a18a690b75fc24585bc557f8ac6156b5ccfbc
MD5 b6ba4488d0141234d9d5a9a3e68fa70c
BLAKE2b-256 0c723375e1b8debc9ca8058a8f3880e1cc77a71696eb87cacb078e495d1e52d5

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