# Cart

The user needs to be authenticated to perform Cart operations, either with a regular user account or with an AnonymousSession (see Authentication).

# Add Product

Adding a product into the cart requires a Product and an AccessMode which represents a mode of access (subscription, rent, purchase, ...), as well as quality and other properties at a set price.

First of all, let's retrieve a Product and its AccessModes.

Assuming that the user wants to rent the movie for a month with streaming access only (accessMode: 2), you would perform the following mutation :

SVOD / TVOD

SVOD and TVOD Products cannot exist in the same Cart due to their different checkout process.

When adding a SVOD Product into a cart containing TVOD Products, the cart will be emptied first before the action is performed (same goes for the other way around).

# Product Ownership

When adding a Product already owned by the user to the cart, you will see the following error:

{
  "errors": [
    {
      "message": "This customer already has an access for this product",
      "locations": [
        {
          "line": 37,
          "column": 3
        }
      ],
      "path": [
        "addProductToCart"
      ],
      "extensions": {
        "code": "BAD_USER_INPUT"
      }
    }
  ],
  "data": null
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

To check if the user already has access to a ProductTVOD, see here. To check if a user already owns an active ProductSVOD see here.

# Remove Product

The removeProductFromCart mutation removes a product from the cart.

Alternatively, you can reset the whole cart using the resetCart mutation.

# Vouchers

To apply vouchers to a Cart, use the addCartVoucher mutation.