openCartWithHttpInfo method
Open a cart for a shopper to fill
Opens an empty cart for a shopper to fill, and answers it with its new id. This is the first step of a sale: hold the id, add items to it with setCartItem, then hand it to checkout. Every field of the request is optional — an empty body opens a perfectly good anonymous cart — and the fields exist only to pre-fill what is already known about the shopper. The STORE defaults to the org's own default storefront, so a merchant selling through one storefront never has to name it. The CURRENCY defaults to usd; note that checkout overrides it with the store's own currency when the sale is authorized, so a currency set here is a hint rather than a commitment. The cart is created in the CALLER'S OWN org namespace, taken from the validated principal and never from the body, so a cart can never be opened on another tenant's books. A named handler, not a closure, so zipdoc can lift this prose into the registry.
Note: This method returns the HTTP Response.
Parameters:
- CartOpen cartOpen (required):
Implementation
Future<Response> openCartWithHttpInfo(CartOpen cartOpen,) async {
// ignore: prefer_const_declarations
final path = r'/v1/commerce/cart';
// ignore: prefer_final_locals
Object? postBody = cartOpen;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}