Cart Service

Back

Overview

The Cart Service manages shopping carts and their line items. Carts support anonymous guest flows, authenticated user sessions, and seamless merge on login.

Each cart is identified by a client-generated GUID and can be associated with a user after login.

Cart types are seeded as follows:

Id Title
1 Guest
2 Wishlist
3 Saved For Later
4 Quote

All cart endpoints are [AllowAnonymous] with rate limiting applied per IP (AnonCart policy), except cart deletion which requires FullManage.

All operations are tenant-aware.


Database tables


Endpoints

Back to Sales

GET

/api/v1/Cart

Returns a cart by its GUID or by user GUID.

Query parameters:

Behavior:

Response:

Authorization:


POST

/api/v1/Cart

Unified cart session endpoint — creates, claims, or merges a cart depending on the fields supplied.

Request body (CartSessionDTO):

Behavior modes:

Scenario Fields supplied Result
Create (guest) {} Creates a new anonymous cart
Create (logged-in) { "userGuid": "..." } Creates a cart owned by the user
Claim { "userGuid": "...", "mergeFromGuid": "..." } Assigns the guest cart to the user if they have no existing cart
Merge { "userGuid": "...", "mergeFromGuid": "..." } Merges the guest cart into the user's existing cart

Response:

Authorization:


POST

/api/v1/Cart/items

Adds, updates, or removes cart items by cart GUID.

Request body (UpsertCartItemsDTO):

Behavior:

Response:

Authorization:


POST

/api/v1/Cart/guid/{guid}/preview

Calculates prices, tax, and totals for a cart without creating a document.

Route parameters:

Request body (PreviewCartRequest):

Behavior:

Response:

Authorization:


POST

/api/v1/Cart/guid/{guid}/convert

Converts a cart into a saved document (sales order). The cart is deleted on success.

Route parameters:

Request body (ConvertCartRequest — extends PreviewCartRequest):

Behavior:

Response:

Authorization:


DELETE

/api/v1/Cart/{id}

Deletes a cart by its internal numeric ID.

Route parameters:

Response:

Authorization:


Models

CartModel

Fields:

Note: Id is present in the DB but omitted from JSON responses.

CartItemPostDTO

Fields used when upserting items via POST /api/v1/Cart/items:

PreviewCartRequest

Fields used for preview and as base for convert:

ConvertCartRequest

Extends PreviewCartRequest. Additional fields:

DocumentAddressSnapshotModel

Used in both billing and shipping snapshot fields:


Notes