Adding items to cart

Once the cart has been created, you can start adding products to in in the form of cart items. A cart can hold a maximum of 100 items. Carts are allowed to contain items from different activities.

Cart items

A cart item contains the following properties:

  • type: Product type
  • product_identifier: Product identifier
  • quantity: Quantity
  • language: Language (if applicable)
  • pickup: Pickup point (if applicable)

Then endpoint for adding items to cart always expects an array in the request body. While most customers add one product at a time, it is possible to add multiple items to a cart. In the example below, we are adding two items for two separate products:

Copy
Copied
curl -X POST '{baseUrl}/carts/{cartUuid}/items' \
-H 'X-Musement-Application: {applicationValue}' \
-H 'X-Musement-Version: 3.4.0' \
-H 'Authorization: Bearer {accessToken}' \
-H 'Content-Type: application/json' \
--data-raw '[
	{
		"type": "musement",
		"product_identifier": "249217479",
		"quantity": 2,
		"language": "it",
		"pickup": "5ee32dbd-898d-4f2e-aa9b-bb430b9a4960"
	},
	{
		"type": "musement",
		"product_identifier": "249217478",
		"quantity": 1,
		"language": "it",
		"pickup": "5ee32dbd-898d-4f2e-aa9b-bb430b9a4960"
	}
]'

Regardless of the number of items in your request, the response will always return the first item. The example request above contained two items, but the response only shows the first one:

Copy
Copied
{
	"uuid": "dd0a0840-f09d-4406-b02a-f672dbf4b172",
	"status": "PREBOOK_OK",
	"quantity": 2,
	[...]
}

Partners can repeat this action for one cart as many times as needed before finalize an order, even with products that belong to different activities.

To confirm that a cart contains all the requested items, call the /carts/{cartUuid} endpoint:
Copy
Copied
curl -X GET '{baseUrl}/carts/{cartUuid}' \
-H 'X-Musement-Application: {applicationValue}' \
-H 'X-Musement-Version: 3.4.0' \
-H 'Authorization: Bearer {accessToken}'

The following is an example response with two items:

Copy
Copied
{
	"uuid": "87881148-9739-4e4c-bffa-d5085e7d74f7",
	"items": [
		{
			"uuid": "dd0a0840-f09d-4406-b02a-f672dbf4b172",
			"status": "PREBOOK_OK",
			"quantity": 2,
			[...]
		},
		{
			"uuid": "a23baee2-b77c-44b1-80ed-d67940af513d",
			"status": "PREBOOK_OK",
			"quantity": 1,
			[...]
		}
	],
	[...]
}

Product type and identifier

Each product has its own type and unique identifier which refer to a specific combination of options based on a customer's selection. For more information on selecting a product, refer to the dedicated section.

Be aware that after an item is added to cart, its product identifier may change. Note the lengthy product_id in the musement-realtime example below:
Copy
Copied
[...]
{
	"holder_code": "standard-price",
	"name": "Standard price",
	"type": "musement-realtime",
	"default": false,
	"product_id": "HruSLWn9fIB9Y8Z8L0/9ritXa7+REpxL9g7drGds1wNH3pcRaR91BKVdJGwuRv6JBg1bJvhTjcQRYzbl/W84dMK2B5wMLGhrHd6jSRBSenMFJ8E+W3j9pHkeqLejqGgIw66Ft00mcUQBfLhPgp6zOKlJuy4YfOMUXLSatCWlM0MtGi57HQ+6GxqCxcetgmg/BvLV1P4c8fVuvuZNhBhT815MKYFANews1zykD1iRTwtd9xiKV7URlbXioUtu9pKZKkmo+Z2icacVnqd+w9S2bgeHPKGosVXOdb1KOP2aq+HxEA6WC9KSwV4nlf8TS8fZ7rDQhu44hVy0U8SAcDEIhmt2OjzmdRoFFhjZdI8ud9W01rQXSKmElOlGXIkt2H2Rt6TNmctDFxHWHnvoPSqc2K7G9Tj4tbWbIAuj2BubaKRW4Q5oiJslnZJ07IufGHWmf9O7PqtAtQP+iGGqvy2C4cC5NYvMxq99DyYLBgJBiDE0rpbot1iTG73UTndGLTXJ3GWQNLOLyJEHGCddxCL2JEllTprXqrL3qo3Ca2h3q6yntmgCrZQOhJjtu3JgdBVB0vDmi15AtuNhS+YoekHzkMMaU2lNNNfaomDtAunHpKlGjotenbECziNV8lpnvNZPlY9eYzWvCihYJRw+A8u2T3zsHmxcClilkSG+3lWx2igYSufmWsjXH1N14YJHyHCvDZsP/u1EauF9+QABduQjoCa6bJAzDX12VZ5r7kToGNhUxOHmjGphYR4V6XAbUn8Lrr5mgd97xDegYKK3lXuzj/B0G2p5t4e/9ceO",
	[...]
}
[...]

After adding the product to cart, its identifier in the response changes to a simpler numeric value:

Copy
Copied
{
	[...]
	"product": {
		"id": "13423401784",
		[...]
	}
}
This change only affects the item in the cart and does not affect the product identifiers in the /activities/{activityUuid}/dates/{date} endpoint.

Quantity

Include the number of products you are purchasing in the quantity property.

Be aware that if the quantity deviates from the min_buy, max_buy or availability restrictions for a product and its timeslot, you may receive an error.

In the example response below, we attempted to add a quantity larger than the product's max_buy and received an error:
Copy
Copied
{
	"code": "2201",
	"message": "Product 4302812251 must have a quantity between 1 and 15. You specified 20."
}

For more information on quantity limits, check out the quantity limits page.

Language

Some activities require selecting a language as part of the order, usually to reserve a dedicated guide or tour materials.

If a product does not include languages, the languages property for an item can be omitted.

For more information, check out the page on product timeslots and languages.

Pickup point

The pickup property in the request body expects a pickup point UUID and is only necessary for activities with pickups. The property can be omitted for activities without pickups.

For more information on obtaining the pickup UUID, refer to the section about pickups points.

Changes in 3.5.0
Starting in version 3.5.0, the API will return a 400 status code when using the pickup property for an activity that does not use pickups.

Adding child products

When adding items to cart for child products, we strongly recommend including items for adult products in the same request.

Some activities are connected to other API platforms which have additional restrictions on bookings, requiring the purchase of adult options together with child options. This information is not available via our API and can lead to errors when trying to add items for adult and child products to cart in separate requests.

While holders can vary depending on the activity configuration, any product which uses a holder_code that contains the word "child" is likely to require an adult product too.

This restriction does not necessarily apply to items with "infant" products, which can usually be added to cart regardless of whether there are items with adult products in the same request.

Copyright © TUI Musement. All rights reserved.