Skip to main content
The Carts API manages persistent shopping carts for B2B ordering. Carts survive across sessions and can be updated freely — add items, adjust quantities, change shipping details, and set a PO number — until you call the checkout endpoint. After checkout, the cart becomes immutable and an order is created. All endpoints require a valid Bearer token. The OrganizationId is read automatically from your JWT claims.

Create a cart

Create a new shopping cart for a customer. Nymble Commerce also adds the first item to the cart in this call, so you supply the initial SKU and quantity alongside the CustomerNumber.

Path parameters

string
required
The customer account number to create the cart for.

Body parameters

string
required
The customer account number (must match the path parameter).
string
required
SKU of the first product to add to the cart.
integer
required
Quantity of the first product to add.
string
required
The type of order this cart represents, e.g. Standard, Quote.

Response

Returns the newly created cart object including the first line item.
If an active cart already exists for this customer, the API returns a 400 error. Nymble Commerce enforces one active cart per customer. Retrieve the existing cart using Get carts for a customer and add items to it instead.

Example


Get a cart by ID

Retrieve a specific cart by its ID, including all line items and computed totals.

Path parameters

string
required
The unique identifier of the cart to retrieve.

Response

Returns a single cart object.

Example


Get carts for a customer

Retrieve all active carts belonging to a specific customer.

Path parameters

string
required
The customer account number to look up carts for.

Response

Returns an array of cart objects for the customer.

Example


List all carts

Retrieve a paginated list of all carts in your organization. This is an admin-only endpoint useful for monitoring order activity across all customers.

Query parameters

integer
default:"1"
The page of results to return.
integer
default:"25"
Number of carts per page.
string
default:"CompanyName"
Field to sort on. Common values: CompanyName, CustomerNumber, Status.
string
default:"asc"
Sort direction. Accepts asc or desc.
array
Optional filter objects. Can filter on CustomerNumber, CompanyName, or Status. Supported operators: startswith, contains, notcontains, endswith, equals, notequals.

Response

Returns a paginated result containing an array of cart objects.

Example


Update a cart

Update metadata on an existing cart, such as the order type or special instructions.

Path parameters

string
required
The customer account number.
string
required
The cart ID to update.

Body parameters

object
required
The updated cart object. Include only the fields you want to change.

Example


Add an item to a cart

Add a product to an existing cart by SKU. If the SKU is already in the cart, Nymble Commerce increases that line item’s quantity rather than adding a duplicate line.

Path parameters

string
required
The customer account number.
string
required
The cart to add the item to.

Body parameters

string
required
The SKU of the product to add.
integer
required
The number of units to add.
string
required
The customer account number (must match the path parameter).

Response

Returns the updated cart object with the new item included.

Example

Adding an item whose SKU is already in the cart increases the existing line item’s quantity. It does not create a second line for the same SKU.

Update an item in a cart

Change the quantity of an existing line item in the cart. The SKU is specified as a path parameter.

Path parameters

string
required
The customer account number.
string
required
The cart containing the item.
string
required
The SKU of the line item to update.

Body parameters

integer
required
The new quantity for this line item. Set to 0 to remove the item from the cart.
string
required
The customer account number.

Response

Returns the updated cart object.

Example


Remove an item from a cart

Delete a line item from the cart by SKU.

Path parameters

string
required
The customer account number.
string
required
The cart to remove the item from.
string
required
The SKU of the line item to remove.

Response

Returns the updated cart object without the removed item.

Example


Set shipping details

Attach or replace the shipping address for a cart.

Path parameters

string
required
The customer account number.
string
required
The cart to update shipping on.

Body parameters

object
required
The shipping address to apply to this cart.
string
required
The customer account number.

Example


Set a PO number

Attach a customer purchase order number to the cart. This value is passed through to the order and invoice.

Path parameters

string
required
The customer account number.
string
required
The cart to apply the PO number to.

Body parameters

string
required
The purchase order number from the customer, e.g. PO-2024-88412.
string
required
The customer account number.

Example


Complete checkout

Submit the cart for processing. Nymble Commerce validates the cart, creates an order, and returns an order number and confirmation ID. After a successful checkout the cart status is set to CLOSED and can no longer be modified.

Path parameters

string
required
The customer account number.
string
required
The cart ID to check out.

Body parameters

string
required
The customer account number (must match the path parameter).
string
required
The sales channel for this order, e.g. Web, Storefront, EDI.
string
The ID of a saved payment profile to charge for this order.
object
Payment details for this order. Required if paymentProfileId is not provided.

Response

string
The assigned order number for the completed order, e.g. MOM-00001.
string
A unique confirmation identifier for this checkout. Use this to reference the order when contacting support.

Example

After a successful checkout, the cart is closed and immutable. Any subsequent attempts to add items or update the cart will return an error. Use the orderNumber to retrieve the full order details and the associated invoice from the Orders API.
Store both the orderNumber and confirmationId in your system immediately after checkout. The orderNumber is used to look up the order and invoice; the confirmationId is the reference to provide customers and for support queries.

The cart object

string
Nymble Commerce’s unique identifier for this cart.
string
The organization this cart belongs to.
string
The customer account number.
string
The customer’s company name.
string
Current cart status. PENDING while the cart is open; CLOSED after checkout.
string
The type of order this cart represents, e.g. Standard, Quote.
string
The price tier applied to this cart, inherited from the customer’s account.
string
ISO 4217 currency code for this cart.
string
The customer purchase order number, if set.
string
Any special delivery or handling instructions.
array
Array of line item objects.
number
Sum of all line totals before shipping and taxes.
object
The shipping address set on this cart.
object
The billing address set on this cart.
string
ISO 8601 timestamp of when the cart was created.
string
ISO 8601 timestamp of the most recent update.