Hanzo
OpenapiCommerce

Read one cart with its lines and totals

Reads one cart: its lines, its status and what it comes to.

GET /v1/commerce/cart/{id}

Addresshttps://api.hanzo.ai/v1/commerce/cart/{id}
MethodGET
OperationgetCart
AuthAuthorization: Bearer $HANZO_API_KEY

Reads one cart: its lines, its status and what it comes to.

This is what a storefront calls to render the basket, and what a support agent calls to see what a shopper is looking at. The totals are the cart's STORED tally — shipping and tax stay zero until checkout resolves a shipping option and a tax region, so a cart total before checkout is the merchandise total and is meant to be.

The org scopes the read by construction: the store is namespaced to it, so a cart id belonging to another tenant is simply not found rather than found and then filtered, and answers 404 rather than 403 so the id space cannot be probed.

A named handler, not a closure, so zipdoc can lift this prose into the registry.

Request

1 field.

FieldInTypeRequiredDescription
idpathstringyesID is the cart's id, as the open call answered it.

Response

StatusBodyMeaning
200Cartok

200 body — 23 fields.

FieldInTypeAlwaysDescription
createdAtbodystringCreatedAt is when the cart was opened, RFC3339.
currencybodystringCurrency is the ISO 4217 code every amount below is denominated in.
discountCentsbodyintegerDiscountCents is what coupons and promotions took off, in whole cents.
emailbodystringEmail is the shopper's address, when the cart carries one.
idbodystringID is the cart's id — what every other cart op addresses it by, and what a storefront persists against the browser session.
itemsbodyCartItem[]Items are the cart's lines, in the order they were added.
items[].freebodybooleanFree reports a line that costs nothing because a coupon or a promotion made it so, rather than because its price is zero.
items[].idbodystringID is the line's identity — the variant id when the line is a variant, otherwise the product id.
items[].kindbodystringKind is "variant" when this line is a specific sellable variant and "product" when it is the product itself.
items[].namebodystringName is the item's display name, cached onto the line when it was added so a cart renders without a second read.
items[].priceCentsbodyintegerPriceCents is the unit price in whole cents, cached at the moment the line was added.
items[].quantitybodyintegerQuantity is how many units of this item the cart holds.
items[].skubodystringSKU is the line's stock-keeping unit — the variant's when it has one, otherwise the product's.
lineTotalCentsbodyintegerLineTotalCents is the sum of the lines before any discount, in whole cents.
orderbodystringOrder is the order this cart became, once checkout completed it.
shippingCentsbodyintegerShippingCents is the shipping charge, in whole cents.
statusbodystringStatus is "active" for a cart still being filled, "ordered" once checkout turned it into an order, and "discarded" when the shopper abandoned it.
storebodystringStore is the storefront the cart is being filled on.
subtotalCentsbodyintegerSubtotalCents is LineTotalCents less DiscountCents, in whole cents.
taxCentsbodyintegerTaxCents is the sales tax, in whole cents.
totalCentsbodyintegerTotalCents is what the shopper pays: subtotal plus shipping plus tax, in whole cents.
updatedAtbodystringUpdatedAt is when the cart was last amended, RFC3339.
userbodystringUser is the signed-in shopper this cart belongs to, empty for a guest cart.

Failure carries the platform error shape — see Errors.

Examples

hanzo has no subcommand for this operation — the CLI serves only what cloud's live route table confirms. Use HTTP or an SDK.


Commerce API · All Hanzo APIs · Interactive reference

How is this guide?

On this page