---
title: "Generate Cart Preview"
method: POST
path: "/cart/generatecartpreview"
tags: ["Cart API"]
---

# Generate Cart Preview

`POST /cart/generatecartpreview`

Creates a cart preview that is populated with product and price information and allows you to obtain the Cleverbridge cart as a JSON or XML file. You can use this resource to access what customers see when they use a certain IP address or language. You can also use the response to populate your web page with product and pricing information stored in the Cleverbridge platform. This circumvents the need to maintain duplicate product and pricing information in both your database and on the Cleverbridge platform. In addition, you have the option of generating a session URL (SURL). For more information, see [Generate User Session URL](https://dev.cleverbridge.com/reference/generateusersessionurl). <br />For XML examples and schemas, see the [Additional Examples - Generate Cart Preview](https://dev.cleverbridge.com/page/additional-examples-generate-cart-preview).

## Headers

- `Accept` 'application/json' | 'application/xml'
- `Content-Type` 'application/json' | 'application/xml'

## Request body

- CleverbridgeBackEndRestApiShoppingCartClassesGenerateCartPreviewRequest
  - `AcceptLanguage` string — The [Accept-Language Header](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields) as submitted by the customer's browser.
  - `GenerateSessionUrl` boolean — Set to <code>true</code> to receive a session URL (SURL) in the response. A session URL is only valid for one purchase or 72 hours after the last web hit for that session has been requested from the Cleverbridge web servers.
  - `RemoteAddress` string, required — The IPv4-Address that corresponds with the country, state, etc. of the customer.
  - `ShoppingCartUrl` string, required — The URL you would use to redirect the customer to the checkout process. If the API request is sent in XML, the URL must be encoded. For more information, see the [HTML URL Encoding Reference](https://www.w3schools.com/tags/ref_urlencode.asp).

## Response `200`

OK

- CleverbridgeBackEndRestApiShoppingCartClassesGenerateCartPreviewResponse
  - `Cart` CleverbridgeBackEndRestApiShoppingCartClassesCartPreview — Preview of the shopping cart with product and pricing information.
    - `CartItems` CleverbridgeBackEndRestApiShoppingCartClassesCartItemPreview[] — List of cart items.
      - `Discount` CleverbridgeDOCUReadmeIOBugItemsDiscountPricing — Discount for the product. For descriptions of the response items, see [Additional Generate Cart Preview Response Items](https://dev.cleverbridge.com/page/additional-generate-cart-preview-response-items).
        - `Currency` string — Name of the currency.
        - `CurrencyId` string — Currency code in capital letters, see [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).
        - `Gross` number, double — Price for the product(s) in the cart, including taxes.
        - `Net` number, double — Price for the product(s) in the cart, not including taxes.
        - `Vat` number, double — Taxes for the product(s) in the cart.
        - `VatPercentage` number, double — Tax rate (percentage).
      - `InternalProductId` string — The client's internal product ID.
      - `Name` string — Product name used in customer communication.
      - `NameExtension` string — Product description. Corresponds to the <b>Additional name information</b> in the Cleverbridge platform.
      - `ProductId` integer — Unique ID of the product.
      - `Quantity` integer — Number of items.
      - `RunningNumber` integer — Running number of the item in the cart.
      - `SinglePrice` CleverbridgeDOCUReadmeIOBugItemsSinglePricing — Pricing information for one unit of a product. For descriptions of the response items, see [Additional Generate Cart Preview Response Items](https://dev.cleverbridge.com/page/additional-generate-cart-preview-response-items).
        - `Currency` string — Name of the currency.
        - `CurrencyId` string — Currency code in capital letters, see [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).
        - `Gross` number, double — Price for the product(s) in the cart, including taxes.
        - `Net` number, double — Price for the product(s) in the cart, not including taxes.
        - `Vat` number, double — Taxes for the product(s) in the cart.
        - `VatPercentage` number, double — Tax rate (percentage).
      - `TotalPrice` CleverbridgeDOCUReadmeIOBugItemsTotalPricing — Pricing information for all units of a product. For descriptions of the response items, see [Additional Generate Cart Preview Response Items](https://dev.cleverbridge.com/page/additional-generate-cart-preview-response-items).
        - `Currency` string — Name of the currency.
        - `CurrencyId` string — Currency code in capital letters, see [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).
        - `Gross` number, double — Price for the product(s) in the cart, including taxes.
        - `Net` number, double — Price for the product(s) in the cart, not including taxes.
        - `Vat` number, double — Taxes for the product(s) in the cart.
        - `VatPercentage` number, double — Tax rate (percentage).
    - `Currency` string — Name of the currency.
    - `CurrencyId` string — Currency code in capital letters, see [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).
    - `Language` string — Name of the language.
    - `LanguageId` string — Two-character ID of the contact's language, see [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1).
    - `TotalPrice` CleverbridgeBackEndRestApiShoppingCartClassesCartPricePreview — Pricing information for the total cart.
      - `Currency` string — Name of the currency.
      - `CurrencyId` string — Currency code in capital letters, see [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).
      - `Gross` number, double — Price for the product(s) in the cart, including taxes.
      - `Net` number, double — Price for the product(s) in the cart, not including taxes.
      - `Vat` number, double — Taxes for the product(s) in the cart.
      - `VatPercentage` number, double — Tax rate (percentage).
  - `SessionUrl` string — The generated session URL.
  - `ResultMessage` string — Optional result or error message.

## Other responses

- `400` — Bad Request
- `500` — Internal Server Error

---

[API](https://skmtc.net/cleverbridge/apis/backend-rest-apis.md) · [All operations](https://skmtc.net/cleverbridge/apis/backend-rest-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cleverbridge/backend-rest-apis/revisions/b7007b62f4c0/schema)
