Initialize Cart

Endpoint

POST
undefined/msapi/sales/shopping-cart-api/v1/carts/initialize

This operation initializes the shopping cart. It is responsible for creating a new cart and returning a valid cart ID, which is essential for all subsequent commerce operations. If a cart already exists for the user, this API will not create a new one; instead, it will return the existing cart ID.

arrowSecurity

http

This API supports Basic Authentication.
scheme:basic
arrowRequest

Initialize Shopping Cart and retrieve cart id.

Header Parameters

          Body Parameters

          Responses

          Success

          arrowBody

          application/json

          REQUEST

          1
          2
          3
          4
          5
          6
          7
          8
          9
          10
          11
          12
          13
          14
          15
          16
          17
          18
          19
          20
          21
          22
          23
          24
          25
          26
          27
          28
          29
          30
          31
          32
          33
          34
          35
          36
          37
          38
          39
          40
          41
          42
          43
          44
          45
          46
          47
          48
          49
          50
          51
          52
          53
          54
          55
          56
          57
          58
          59
          60
          61
          62
          63
          64
          65
          curl --request POST \
               --url https://example.com/msapi/sales/shopping-cart-api/v1/carts/initialize \
               --header 'accept: application/json;charset=utf-8' \
               --header 'content-type: application/json;charset=utf-8' \
               --data '
          {
            "cartType": "ATTCart",
            "channel": {
              "id": "ATTR",
              "name": "ATTR",
              "extensions": [
                {
                  "name": "StoreId",
                  "value": "12334"
                },
                {
                  "name": "AgentId",
                  "value": "sv1323"
                }
              ]
            },
            "relatedParty": [
              {
                "id": "00fa7310-38c9-11ec-8d3d-0242ac130003",
                "role": "Profile",
                "extensions": [
                  {
                    "name": "zipCode",
                    "value": "98021"
                  },
                  {
                    "name": "user-type",
                    "value": "anonymous"
                  }
                ]
              },
              {
                "role": "Customer",
                "extensions": [
                  {
                    "name": "customerType",
                    "value": "Consumer"
                  },
                  {
                    "name": "customerSubType",
                    "value": "Individual"
                  },
                  {
                    "name": "accessEligible",
                    "value": "true"
                  }
                ]
              },
              {
                "id": "00fa7310-38c9-11ec-8d3d-0242ac130003",
                "role": "Individual"
              },
              {
                "@referredType": "fan",
                "id": "03008386 ",
                "role": "partner"
              }
            ]
          }
          '

          RESPONSE

          1
          2
          3
          4
          5
          6
          7
          8
          9
          10
          11
          12
          13
          14
          15
          16
          17
          18
          19
          20
          21
          22
          23
          24
          25
          26
          27
          28
          29
          30
          31
          32
          33
          34
          35
          36
          37
          38
          39
          40
          41
          42
          43
          44
          45
          46
          47
          48
          49
          50
          51
          52
          53
          54
          55
          56
          57
          {
            "id": "7aaeaaa0-e38b-11ed-87c3-a77f9285ffc6",
            "orderDate": "2023-04-25T17:06:11.658Z",
            "lastUpdate": "2023-04-25T17:06:11.658Z",
            "channel": [
              {
                "id": "ATTR",
                "name": "ATTR",
                "role": "agent",
                "extensions": [
                  {
                    "name": "storeId",
                    "value": "12334"
                  },
                  {
                    "name": "agentId",
                    "value": "sv12345"
                  },
                  {
                    "name": "Application",
                    "value": "myATTNative"
                  }
                ]
              }
            ],
            "relatedParty": [
              {
                "id": "00fa7319-38c9-11ec-8d3d-0242at2",
                "role": "Profile",
                "extensions": [
                  {
                    "name": "user-type",
                    "value": "anonymous"
                  }
                ]
              },
              {
                "role": "Customer",
                "extensions": [
                  {
                    "name": "customerType",
                    "value": "Consumer"
                  },
                  {
                    "name": "customerSubType",
                    "value": "Individual"
                  },
                  {
                    "name": "accessEligible",
                    "value": "true"
                  }
                ]
              }
            ],
            "state": "inProgress",
            "@type": "DEFAULT"
          }