Overview
Cart Management provides:- Real-time Merchant Integration: All operations are transmitted to merchant systems in real-time
- Session-based Cart Management: Carts are managed through device-based authentication
- Multi-shipment Support: Items are organized into shipments based on merchant configuration
- Automatic Pricing: Price calculations including tax and shipping from merchant systems
Key Concepts
Cart Structure
Carts contain:Line Items
Individual products with quantities, pricing, and metadata
Shipments
Items grouped based on merchant-defined fulfillment rules
Pricing
Calculated subtotal, shipping, tax, addon costs, and total
Addons
Available and selected value-added services
Merchant Integration
All cart operations are processed through the merchant’s systems in real-time. Firmly acts as a unified interface to the merchant’s cart functionality.
Available Endpoints
Get Cart
Retrieve the current cart state with all items, shipments, and pricing
Add Line Item
Add new products to the cart
Update Line Item
Modify quantities or remove items from the cart
Clear Cart
Remove all items from the cart
Typical Cart Flow
1
Initialize Cart
Cart is automatically created on first item addition or can be retrieved if exists
2
Add Items
Use Add Line Item endpoint to add products with SKU, quantity, and price
3
Review Cart
Get Cart returns complete state including shipments and pricing
4
Modify as Needed
Update quantities or remove items using Update Line Item
5
Proceed to Checkout
Once cart is finalized, move to shipment configuration and checkout
Example: Building a Cart
1. Add First Item
2. Add Another Item
3. Review Cart State
Important Behaviors
- Items are assigned to shipments based on merchant rules
- Shipment groupings are determined by the merchant’s system
- Price calculations happen through the merchant’s pricing engine
- Cart state persists based on merchant configuration
Error Handling
Common errors when managing carts:| Error Code | Description | Resolution |
|---|---|---|
InvalidSKU | Product SKU not found | Verify SKU exists in merchant catalog |
InvalidQuantity | Quantity less than or equal to 0 or non-integer | Use positive integer quantities |
CartNotFound | Cart doesn’t exist | Cart may have expired, start new session |
MerchantError | Merchant system returned an error | Check merchant-specific error details |