Python SDK for AI Agent Payment Network - Hybrid crypto + fiat payments
Project description
Agent Payment Network SDK
Python SDK for integrating with the AI Agent Payment Network - enabling hybrid crypto + fiat payments for AI agents.
Installation
pip install agent-payment-sdk
Or install from source:
git clone https://github.com/SuryaRaut/agent-payment-network
cd agent-payment-network/sdk/python
pip install -e .
Quick Start
from agent_payment_sdk import AgentPaymentClient
# Initialize client
client = AgentPaymentClient(
api_key="your_api_key_here", # Optional for testing
base_url="http://localhost:8000"
)
# Create a payment
payment = client.create_payment(
to_agent_id="agent_456",
amount=50.00,
currency="USD",
payment_method="stripe_card", # or "crypto" or "auto"
memo="Payment for API usage"
)
print(f"Payment ID: {payment['payment_id']}")
print(f"Status: {payment['status']}")
print(f"Client Secret: {payment['client_secret']}")
# Check payment status
status = client.get_payment(payment['payment_id'])
print(f"Current status: {status['status']}")
Payment Methods
Crypto Payments (ETH on Base)
# Add crypto wallet
method = client.add_payment_method(
agent_id="agent_123",
method_type="crypto_wallet",
wallet_address="0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
is_default=True
)
# Make crypto payment
payment = client.create_payment(
to_agent_id="agent_456",
amount=0.01,
currency="ETH",
payment_method="crypto"
)
Stripe Payments (Credit/Debit Cards)
# Add Stripe card (payment_method_id from Stripe.js frontend)
method = client.add_payment_method(
agent_id="agent_123",
method_type="stripe_card",
stripe_payment_method_id="pm_1234567890",
is_default=True
)
# Make card payment
payment = client.create_payment(
to_agent_id="agent_456",
amount=100.00,
currency="USD",
payment_method="stripe_card"
)
API Reference
AgentPaymentClient
__init__(api_key, base_url, timeout)
Initialize the client.
create_payment(to_agent_id, amount, currency, payment_method, memo)
Create a new payment.
get_payment(payment_id)
Get payment status.
health_check()
Check API health.
add_payment_method(agent_id, method_type, ...)
Add payment method.
list_payment_methods(agent_id)
List all payment methods.
delete_payment_method(method_id)
Remove payment method.
Error Handling
from agent_payment_sdk import PaymentError, NetworkError
try:
payment = client.create_payment(
to_agent_id="agent_456",
amount=50.00
)
except PaymentError as e:
print(f"Payment failed: {e}")
except NetworkError as e:
print(f"Network error: {e}")
Features
- ✅ Hybrid crypto + fiat payments
- ✅ Automatic payment method selection
- ✅ Payment method management
- ✅ Type hints for better IDE support
- ✅ Comprehensive error handling
- ✅ Simple, intuitive API
Support
- Documentation: https://docs.agentpayment.network
- Issues: https://github.com/SuryaRaut/agent-payment-network/issues
- Email: itssuryaraut@gmail.com
License
MIT License - see LICENSE file for details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agent_payment_sdk-0.2.0.tar.gz.
File metadata
- Download URL: agent_payment_sdk-0.2.0.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e2acfecb3b707d0ae2aaf3aaa6cf9d39682ef45342a0d09d271fd1deb06b370
|
|
| MD5 |
5260858c7da21634302d2393a9becdd4
|
|
| BLAKE2b-256 |
6d607ad06aca8b9f54dff1a5f3860fdfe8b7f3392b78b6cf4def42053cc831fe
|
File details
Details for the file agent_payment_sdk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: agent_payment_sdk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e5dc02871bd8fe77b43bc76eaea7123545e696d90d0876727eb43287123710a
|
|
| MD5 |
e151cbb4cb74ddcd35477c40c609acc4
|
|
| BLAKE2b-256 |
989429db9ef664ad00f1d214ac71a8ae9165771eb081f50001e66ff74a7c1eed
|