Cart Service

Back

For validation semantics (errors/warnings, the atomic upsert contract, preview/convert correlation) see the Cart Validation & Checkout — Frontend Integration Guide. This page covers the endpoints and session/merge mechanics only.

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}/invalid-items/remove

Removes exactly the error-severity items excluded for the supplied EntityId, PriceListId, and DocumentTypeGuid context. Send all their CartItemId values as CartItemIds. The API revalidates before removal and returns 409 CartConcurrencyConflict if the set changed. Success returns the updated CartModel; valid items remain untouched.


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. 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. Each CartItemModel does include its own Id in JSON so preview cartItemId values can be joined back to cart rows.

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