Overview
The Baskets API provides complete shopping cart functionality with item management, status tracking, and checkout capabilities. Returns BasketInstance objects with direct property access.Direct Access
Access
basket.itemCount not basket.common.itemCountInstance Methods
Built-in methods like
addItem(), placeOrder()Auto-Sync
Properties update after method calls
Type-Safe
Full TypeScript support
Basket Statuses
- ACTIVE
- CHECKED_OUT
- ABANDONED
- EXPIRED
Currently being used for shoppingDefault status for new baskets
Methods
create()
Create a new shopping basket.Currency code (USD, EUR, GBP, etc.)
Custom metadata to store with basket
BasketInstance with direct property access and methods
Example:
get()
Retrieve baskets, optionally filtered by status.getById()
Get a specific basket by ID.BasketInstance with direct property access
Example:
addItem()
Add an item to a basket.ID of the basket
Product ID
Item price
Quantity to add
Stock keeping unit
Basket data. Instance method returns BasketInstance with updated item count and total.
Example:
removeItem()
Remove an item from a basket.clear()
Remove all items from a basket.updateStatus()
Update basket status.updateMetadata()
Update basket metadata.placeOrder()
Convert basket to order (checkout).Shipping address information
Payment method (e.g., ‘stripe’, ‘paypal’)
Basket ID to convert to order
BasketInstance
All basket methods returnBasketInstance objects with:
Direct Property Access:
Complete Shopping Flow Example
Best Practices
Verify Basket Exists
Verify Basket Exists
Check Items Before Checkout
Check Items Before Checkout
Store Metadata
Store Metadata
Use metadata for tracking:
Handle Abandoned Baskets
Handle Abandoned Baskets
Common Patterns
View Cart
Apply Discount
Next Steps
Orders API
Manage orders after checkout
Basket Examples
See complete workflow examples

