Overview
ChaosChain SDK supports 5 W3C-compliant payment methods for comprehensive payment processing. From traditional cards to crypto payments, handle all payment types with a unified API.Live Crypto Payments
A2A-x402 with real USDC transfers on Base Sepolia
Traditional Methods
Cards, Google Pay, Apple Pay, PayPal with real API integrations
Supported Payment Methods
β LIVE & WORKING (Out-of-the-Box)
Method | W3C Identifier | Status | Settlement |
---|---|---|---|
A2A-x402 Crypto | https://a2a.org/x402 | β LIVE | Real USDC Transfers on Base Sepolia |
π§ REAL API INTEGRATIONS (Add Your Credentials)
Method | W3C Identifier | Status | What You Need |
---|---|---|---|
Basic Cards | basic-card | β REAL Stripe API | Add STRIPE_SECRET_KEY |
PayPal | https://paypal.com | β REAL PayPal API | Add PAYPAL_CLIENT_ID + PAYPAL_CLIENT_SECRET |
Google Pay | https://google.com/pay | β REAL Token Validation | Add GOOGLE_PAY_MERCHANT_ID |
Apple Pay | https://apple.com/apple-pay | β REAL Token Validation | Add APPLE_PAY_MERCHANT_ID |
A2A-x402 Crypto Payments
The A2A-x402 protocol enables real USDC transfers between agents with automatic protocol fees.Features
- β Real USDC Transfers on Base Sepolia
- β Automatic Protocol Fees (2.5% to ChaosChain treasury)
- β Multi-Network Support (Base, Ethereum, Optimism Sepolia)
- β Instant Settlement with transaction proofs
Usage Example
Payment Flow
1
Create Request
Agent creates A2A-x402 payment request with items and total amount
2
Generate Settlement
SDK generates settlement address and calculates protocol fees
3
Execute Transfer
USDC is transferred from payer to settlement address
4
Fee Collection
Protocol fee (2.5%) is automatically sent to ChaosChain treasury
Traditional Payment Methods
All traditional payment methods use real API integrations with production payment processors.Basic Card Payments (Stripe)
Process credit and debit cards through Stripeβs API:Google Pay Integration
Process Google Pay payments with token validation:Apple Pay Integration
Process Apple Pay payments with certificate validation:PayPal Integration
Process PayPal payments through their REST API:Multi-Payment Example
Handle multiple payment methods in a single application:multi_payment_agent.py
Payment Configuration
Environment Variables
Set up your payment processor credentials:.env
Demo Mode Fallback
If credentials arenβt provided, the SDK automatically falls back to demo mode:Protocol Fees
ChaosChain automatically collects protocol fees on crypto payments:- Fee Rate: 2.5% of transaction amount
- Collection: Automatic on A2A-x402 payments
- Destination: ChaosChain treasury address
- Traditional Payments: No protocol fees (handled by payment processors)
Fee Calculation Example
Error Handling
Handle payment errors gracefully:Best Practices
Security
Security
- Never log payment credentials or sensitive data
- Use HTTPS for all payment communications
- Validate payment data before processing
- Store credentials in environment variables, not code
Error Handling
Error Handling
- Implement retries for network failures
- Provide clear feedback to users on payment status
- Log errors for debugging (without sensitive data)
- Handle timeouts gracefully
User Experience
User Experience
- Show supported methods to users
- Provide payment status updates
- Handle demo mode transparently
- Offer multiple options for payment flexibility