Add items to cart + checkout (all in one)

Description

This service provides a convenient one-step method to both add one or more items to a new cart and immediately proceed with the checkout, generating the final order(s).


Request

Restrictions

This service requires an authenticated user.

Endpoint

POST https://<server-url>/api/v4/mileage/{activity_code}/cart/addItemsToCartAndCheckout

Path Parameters

Parameter
Type
Description

activity_code

String

The unique code for the mileage activity.

Parameters

Parameter
Location
Description

touchpoint

Query / Header

The identifier for the touchpoint. Use Thalamus-Touchpoint for the header.

token

Query / Header

The authentication token for the API session. Use Thalamus-Token for the header.

Full URL Example

https://<server-url>/api/v4/mileage/MPOINTS/cart/addItemsToCartAndCheckout?touchpoint=test&token=...

Request Body

The request body is a JSON object with two main properties: one for the items being added (singleCartItemsElement), and one for the checkout and delivery details (cartDeliveryInformationElement).

Top-Level Structure

Field
Type
Description

singleCartItemsElement

Object

Contains the list of items to add to the cart and checkout.

cartDeliveryInformationElement

Object

Contains all the delivery and checkout details for the order.

singleCartItemsElement Fields

Field
Type
Description

items

Array

An array of item objects, each with an itemCode (String) and quantity (Integer).

cartDeliveryInformationElement Fields This object contains the delivery and order information. You must provide one of the delivery options (addressCode, exchangeCenterId, etc.).

Field
Type
Description

status

String

The desired status of the order, typically "CHECKOUT".

addressCode

String

Delivery Option 1. The code for the consumer's delivery address.

exchangeCenterId

Integer

Delivery Option 2. The ID of the exchange center for pickup.

physicalLocationId

Integer

Delivery Option 3. The ID of a physical location for delivery.

principal

String

Delivery Option 4. The principal of a physical location, formatted as profileField|principalValue (e.g., fiscalId|72857877536).

message

String

Optional. A message to include with the order.

description2-10

String

Optional. Custom description fields for the overall order.

description2-3ForAccountMovement

String

Optional. Custom descriptions for the account movement record.

Example Body Structure JSON

{
  "singleCartItemsElement": {
    "items": [
      {
        "itemCode": "codigo2",
        "quantity": 1
      }
    ]
  },
  "cartDeliveryInformationElement": {
    "addressCode": "address",
    "status": "CHECKOUT",
    "message": "Fragile",
    "description2ForAccountMovement": "desc 2"
  }
}

Response

✅ Successful Response: 200 OK

The items were added and the checkout was successful. The response contains an array of the newly created orders.

JSON

{
  "orders": [
    {
      "orderNumber": 52,
      "creationDate": 1636575088521,
      "orderState": "Received",
      "addressCode": "",
      "message": "Fragile",
      "total": 0.0,
      "physicalLocationOriginId": 5,
      "items": [
        {
          "item": {
            "code": "t1",
            "name": "tomate",
            "itemType": "VIRTUAL_ITEM",
            "price": 0.0
          },
          "quantity": 1,
          "total": 0.0,
          "voucher": {
            "code": "ewwew",
            "state": "DELIVERED"
          }
        }
      ]
    }
  ]
}

❌ Unsuccessful Response: 400 Bad Request

Returned for logical errors such as items being out of stock or conflicting delivery information.

JSON

{
  "errors": {
    "item": "NotInStock",
    "profile": "IncompleteAddress",
    "checkout": "NotUniqueDeliveryMethod"
  }
}

❌ Unsuccessful Response: 404 Not Found

Returned if a specified resource like the activity, address, or an item code does not exist.

JSON

{
  "errors": {
    "error.message": "NOT_FOUND",
    "address": "InvalidCode",
    "exchangeCenter": "InvalidID"
  }
}

Last updated

Was this helpful?