Payments
Payment processing, billing, and financial services.
Overview
Financial operations are handled by five services:
| Service | Port | Purpose |
|---|---|---|
| payment_service | 8207 | Stripe, crypto, payment intents |
| wallet_service | 8208 | Virtual wallets, balances |
| billing_service | 8216 | Invoicing, usage billing |
| subscription_service | 8228 | Subscription lifecycle |
| credit_service | 8229 | Credit system, redemption |
Payment Service (8207)
Create Payment Intent
curl -X POST "http://localhost:8207/api/v1/payments/intent" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"amount": 2999,
"currency": "usd",
"description": "Pro Plan - Monthly"
}'Confirm Payment
curl -X POST "http://localhost:8207/api/v1/payments/intent/pi_abc123/confirm" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"payment_method_id": "pm_card_visa"}'Process Refund
curl -X POST "http://localhost:8207/api/v1/payments/pi_abc123/refund" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"amount": 2999, "reason": "customer_request"}'Wallet Service (8208)
Get Wallet Balance
curl "http://localhost:8208/api/v1/wallets/me" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"Add Funds
curl -X POST "http://localhost:8208/api/v1/wallets/me/deposit" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"amount": 5000,
"currency": "usd",
"payment_method_id": "pm_card_visa"
}'Subscription Service (8228)
Create Subscription
curl -X POST "http://localhost:8228/api/v1/subscriptions" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"plan_id": "plan_pro_monthly",
"payment_method_id": "pm_card_visa"
}'Cancel Subscription
curl -X POST "http://localhost:8228/api/v1/subscriptions/me/cancel" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"at_period_end": true}'Credit Service (8229)
Get Credits
curl "http://localhost:8229/api/v1/credits/me" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"Purchase Credits
curl -X POST "http://localhost:8229/api/v1/credits/purchase" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"package": "credits_1000",
"payment_method_id": "pm_card_visa"
}'Credit Packages
| Package | Credits | Price |
|---|---|---|
| Starter | 100 | $10 |
| Standard | 500 | $45 |
| Pro | 1000 | $80 |
| Enterprise | 5000 | $350 |
Webhook Events
| Event | Description |
|---|---|
payment.succeeded | Payment completed |
payment.failed | Payment failed |
subscription.created | New subscription |
subscription.canceled | Subscription canceled |
invoice.paid | Invoice paid |
Python SDK
from isa_user import PaymentClient, WalletClient
payment = PaymentClient("http://localhost:8207")
wallet = WalletClient("http://localhost:8208")
# Create payment intent
intent = await payment.create_intent(
token=access_token,
amount=2999,
currency="usd"
)
# Check wallet balance
balance = await wallet.get_balance(token=access_token)Next Steps
- Storage - File management
- Organizations - Multi-tenant
- Authentication - Auth details