Skip to Content

Commerce

Order management and product catalog services.

Overview

Commerce capabilities are handled by two services:

ServicePortPurpose
order_service8210Order lifecycle, fulfillment
product_service8215Product catalog, pricing

Order Service (8210)

Create Order

curl -X POST "http://localhost:8210/api/v1/orders" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "items": [ {"product_id": "prod_123", "quantity": 2, "unit_price": 2999} ], "payment_method_id": "pm_card_visa", "shipping_address": { "line1": "123 Main St", "city": "San Francisco", "state": "CA", "postal_code": "94102", "country": "US" } }'

Get Order

curl "http://localhost:8210/api/v1/orders/ord_abc123" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"

Complete Order

curl -X POST "http://localhost:8210/api/v1/orders/ord_abc123/complete" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "fulfillment_details": { "tracking_number": "1Z999AA10123456784", "carrier": "ups" } }'

Order Status

StatusDescription
pendingAwaiting payment
paidPayment received
processingBeing prepared
shippedOrder shipped
completedOrder fulfilled
cancelledOrder cancelled

Product Service (8215)

Create Product

curl -X POST "http://localhost:8215/api/v1/products" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Pro Plan", "description": "Professional features", "type": "subscription", "category": "software", "pricing": { "type": "recurring", "amount": 2999, "currency": "usd", "interval": "month" } }'

Get Product Pricing

curl "http://localhost:8215/api/v1/products/prod_abc123/pricing" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"

Product Types

TypeDescription
one_timeSingle purchase
subscriptionRecurring
meteredUsage-based
credit_packCredit package

Pricing Models

{ "one_time": {"type": "one_time", "amount": 9999}, "recurring": {"type": "recurring", "amount": 2999, "interval": "month"}, "metered": {"type": "metered", "unit_amount": 1, "unit": "api_call"}, "tiered": { "type": "tiered", "tiers": [ {"up_to": 1000, "unit_amount": 10}, {"up_to": 10000, "unit_amount": 8} ] } }

Python SDK

from isa_user import OrderClient, ProductClient orders = OrderClient("http://localhost:8210") products = ProductClient("http://localhost:8215") # Create order order = await orders.create( token=access_token, items=[{"product_id": "prod_123", "quantity": 1}], payment_method_id="pm_card_visa" ) # Complete order await orders.complete( token=access_token, order_id=order.order_id )

Next Steps