> ## Documentation Index
> Fetch the complete documentation index at: https://docs.clearline.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Automated Flow in POS System Checkout

> Implement fully automated widget triggering based on transaction events

## Overview

The Automated Flow is designed for fully automated POS system integrations where widget sessions are triggered in real-time based on transaction events—without the need for manual input from the operator. This enables seamless customer engagement during the checkout process.

***

## Check POS Settings

Before starting a transaction, the POS system must check whether marketing transactions are enabled for the specific POS system.

<CodeGroup>
  ```bash Request theme={null}
  GET https://public-api-test.clearline.me/pos/{posSystem}/settings/{companyPosId}
  ```

  ```json Response theme={null}
  {
    "data": {
      "settings": {
        "isCheckInMenuEnabled": true,
        "isTransactionsEnabled": true,
        "isPosRulesEnabled": true,
        "isReceiptPromotionEnabled": true,
        "isCouponsEnabled": true,
        "isProductsImportEnabled": true
      }
    }
  }
  ```
</CodeGroup>

### Headers

| Name          | Value                | Description                  |
| ------------- | -------------------- | ---------------------------- |
| Authorization | Bearer access\_token | Request authorization header |
| Content-Type  | application/json     | Content type                 |

### Path Parameters

| Field name   | Type   | Description                                          |
| ------------ | ------ | ---------------------------------------------------- |
| posSystem    | string | The identifier of the POS system (e.g., pax, clover) |
| companyPosId | string | The company POS identifier                           |

### Response Fields

<ResponseField name="data" type="object">
  POS system configuration settings

  <Expandable title="Settings Properties">
    <ResponseField name="settings" type="object">
      Feature flags for the POS system

      <Expandable title="Feature Flags">
        <ResponseField name="isCheckInMenuEnabled" type="boolean">
          Indicates if check-in menu is enabled
        </ResponseField>

        <ResponseField name="isTransactionsEnabled" type="boolean">
          Indicates if transactions are enabled
        </ResponseField>

        <ResponseField name="isPosRulesEnabled" type="boolean">
          Indicates if POS rules are enabled
        </ResponseField>

        <ResponseField name="isReceiptPromotionEnabled" type="boolean">
          Indicates if receipt promotion is enabled
        </ResponseField>

        <ResponseField name="isCouponsEnabled" type="boolean">
          Indicates if coupons are enabled
        </ResponseField>

        <ResponseField name="isProductsImportEnabled" type="boolean">
          Indicates if products import is enabled
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<Warning>
  If `isTransactionsEnabled` is `false`, the POS system should **not** send any transactions to ClearLine.
</Warning>

***

## Start a New Interaction

Start a new session between the POS system and the marketing platform. This creates a session identifier that will be used to track the transaction flow.

<CodeGroup>
  ```bash Request theme={null}
  POST https://public-api-test.clearline.me/pos/{posSystem}/startInteraction
  ```

  ```json Request Body theme={null}
  {
    "posLocationId": "{posLocationId}",
    "terminalId": "{terminalId}"
  }
  ```

  ```json Response theme={null}
  {
    "data": {
      "sessionId": "f7892b12-e01a-4717-a306-fce8af792b9c",
      "posStatus": "Accepted"
    }
  }
  ```
</CodeGroup>

### Headers

| Name          | Value                | Description                  |
| ------------- | -------------------- | ---------------------------- |
| Authorization | Bearer access\_token | Request authorization header |
| Content-Type  | application/json     | Content type                 |

### Path Parameters

| Field name | Type   | Description                                          |
| ---------- | ------ | ---------------------------------------------------- |
| posSystem  | string | The identifier of the POS system (e.g., pax, clover) |

### Request Body

| Field name    | Type   | Required | Description                        |
| ------------- | ------ | -------- | ---------------------------------- |
| posLocationId | string | Yes      | The identifier of the POS location |
| terminalId    | string | Yes      | The identifier of the POS terminal |

### Response Fields

<ResponseField name="data" type="object">
  Session initialization data

  <Expandable title="Properties">
    <ResponseField name="sessionId" type="string">
      Unique identifier of the session to be used in subsequent API calls
    </ResponseField>

    <ResponseField name="posStatus" type="string">
      POS status indicating the result: `Accepted`, `Disabled`, or `NotAvailable`
    </ResponseField>
  </Expandable>
</ResponseField>

***

## Send Transaction Details

Send a completed POS transaction to the marketing platform. This action may trigger the execution of a widget session automatically based on configured POS rules.

<CodeGroup>
  ```bash Request theme={null}
  POST https://public-api-test.clearline.me/pos/{posSystem}/transaction
  ```

  ```json Request Body theme={null}
  {
    "posLocationId": "{posLocationId}",
    "transactionId": "{transactionId}",
    "transactionType": "Sale",
    "transactionAmount": "19",
    "transactionDate": "2025-07-25T19:51:30.113",
    "terminalID": "{terminalID}",
    "sessionId": "{sessionId}",
    "customer": {
      "id": "",
      "firstName": "test210525p",
      "lastName": "test210525p",
      "birthDate": "1985-05-21T00:00:00",
      "contacts": [
        {
          "email": "test210525p@mail.com",
          "phone": "11111111111"
        }
      ]
    },
    "products": [
      {
        "productId": "10285",
        "productName": "Milk",
        "manufacturer": "Best",
        "productCategory": "Food",
        "quantity": 1
      }
    ],
    "loyalty": {
      "cardNumber": null
    }
  }
  ```

  ```json Response theme={null}
  {
    "data": {
      "id": "6886834645735100017eac4b",
      "qrCodeWidget": {
        "shortLinkUrl": "https://shorttest.clearline.me/RE-klOWT?sessionId=f7232bcc-e01a-4717-a306-fce8af792b9c&cashRegisterId=962",
        "qrCode": {
          "htmlLinkUrl": "https://webtest.clearline.me:443/qrcode/Html?..",
          "previewHtmlLinkUrl": "https://webtest.clearline.me:443/qrcode/Html?.."
        },
        "notificationMessageId": null,
        "profile": {
          "id": "6787d9bf6430560001023385",
          "firstName": "test210525p",
          "lastName": "test210525p",
          "customerEmail": "test210525p@mail.com",
          "customerPhone": "+11111111111",
          "salesPerson": null,
          "purchaseName": null,
          "purchaseId": null,
          "purchaseCategory": null,
          "purchasePrice": null,
          "gender": "False"
        },
        "sessionId": "f7232bcc-e01a-4717-a306-fce8af792b9c"
      },
      "cfsTemplate": {
        "accountTemplateId": 0,
        "cfsCarouselUrl": null
      },
      "posStatus": "Accepted",
      "loyalty": {
        "status": "NotFound",
        "awardDescription": null,
        "qrCode": {
          "linkUrl": "https://shorttest.clearline.me/RT-aTqH0",
          "qrCodeLinkUrl": "https://webtest.clearline.me:443/qrcode/Png..",
          "primaryText": "Join Our Loyalty Program! <br>  Scan the QR Code to register for the Loyalty Program!",
          "secondaryText": "SCAN ME"
        }
      }
    }
  }
  ```
</CodeGroup>

### Headers

| Name          | Value                | Description                  |
| ------------- | -------------------- | ---------------------------- |
| Authorization | Bearer access\_token | Request authorization header |
| Content-Type  | application/json     | Content type                 |

### Path Parameters

| Field name | Type   | Description                                          |
| ---------- | ------ | ---------------------------------------------------- |
| posSystem  | string | The identifier of the POS system (e.g., pax, clover) |

### Request Body

| Field name        | Type      | Required | Description                                  |
| ----------------- | --------- | -------- | -------------------------------------------- |
| posLocationId     | string    | Yes      | The identifier of the POS location           |
| transactionId     | string    | Yes      | Unique transaction identifier                |
| transactionType   | string    | Yes      | Type of transaction (e.g., "Sale")           |
| transactionAmount | string    | Yes      | Total transaction amount                     |
| transactionDate   | string    | Yes      | Transaction date and time in ISO 8601 format |
| terminalID        | string    | Yes      | The identifier of the POS terminal           |
| sessionId         | string    | Yes      | Session ID from the startInteraction call    |
| customer          | object    | No       | Customer information                         |
| products          | object\[] | No       | Array of products in the transaction         |
| loyalty           | object    | No       | Loyalty program information                  |

### Response Fields

<ResponseField name="data" type="object">
  Transaction processing result with triggered marketing actions

  <Expandable title="Properties">
    <ResponseField name="id" type="string">
      Transaction identifier in ClearLine system
    </ResponseField>

    <ResponseField name="qrCodeWidget" type="object">
      QR code widget information if a widget was triggered

      <Expandable title="QR Code Widget Properties">
        <ResponseField name="shortLinkUrl" type="string">
          Shortened URL for the widget
        </ResponseField>

        <ResponseField name="qrCode" type="object">
          QR code URLs for display
        </ResponseField>

        <ResponseField name="profile" type="object">
          Customer profile information
        </ResponseField>

        <ResponseField name="sessionId" type="string">
          Session identifier for this widget interaction
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="cfsTemplate" type="object">
      Customer-facing screen template information

      <Expandable title="CFS Template Properties">
        <ResponseField name="accountTemplateId" type="integer">
          Template identifier
        </ResponseField>

        <ResponseField name="cfsCarouselUrl" type="string">
          URL for the CFS carousel display
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="posStatus" type="string">
      Transaction processing status: `Accepted`, `Disabled`, or `NotAvailable`
    </ResponseField>

    <ResponseField name="loyalty" type="object">
      Loyalty program response

      <Expandable title="Loyalty Properties">
        <ResponseField name="status" type="string">
          Loyalty status (e.g., "NotFound", "Active")
        </ResponseField>

        <ResponseField name="awardDescription" type="string">
          Description of loyalty award if applicable
        </ResponseField>

        <ResponseField name="qrCode" type="object">
          QR code for loyalty program enrollment or rewards
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

***

## Validate Coupon by Transaction

Validate coupons associated with a specific POS transaction within a marketing campaign session. This endpoint confirms coupon usage and records it in the system.

<CodeGroup>
  ```bash Request theme={null}
  POST https://public-api-test.clearline.me/pos/{posSystem}/coupon/validate/byTransaction
  ```

  ```json Request Body theme={null}
  {
    "sessionId": "string",
    "campaignId": "string",
    "transactionId": "string",
    "couponUser": {
      "firstName": "string",
      "lastName": "string",
      "gender": "string",
      "phone": "string",
      "email": "string"
    }
  }
  ```

  ```json Response theme={null}
  {
    "posStatus": "Accepted",
    "data": {
      "externalSessionId": "{externalSessionId}",
      "status": "Accepted",
      "validationDate": "2025-07-23T20:02:40.049Z",
      "errorMessage": ""
    }
  }
  ```
</CodeGroup>

### Headers

| Name          | Value                | Description                  |
| ------------- | -------------------- | ---------------------------- |
| Authorization | Bearer access\_token | Request authorization header |
| Content-Type  | application/json     | Content type                 |

### Path Parameters

| Field name | Type   | Description                                          |
| ---------- | ------ | ---------------------------------------------------- |
| posSystem  | string | The identifier of the POS system (e.g., pax, clover) |

### Request Body

| Field name    | Type   | Required | Description                                     |
| ------------- | ------ | -------- | ----------------------------------------------- |
| sessionId     | string | Yes      | Session identifier from startInteraction call   |
| campaignId    | string | Yes      | Marketing campaign identifier                   |
| transactionId | string | Yes      | POS transaction identifier                      |
| couponUser    | object | Yes      | Information about the customer using the coupon |

### Coupon User Object

| Field name | Type   | Required | Description              |
| ---------- | ------ | -------- | ------------------------ |
| firstName  | string | No       | Customer's first name    |
| lastName   | string | No       | Customer's last name     |
| gender     | string | No       | Customer's gender        |
| phone      | string | No       | Customer's phone number  |
| email      | string | No       | Customer's email address |

### Response Fields

<ResponseField name="posStatus" type="string">
  Overall POS status: `Accepted`, `Disabled`, or `NotAvailable`
</ResponseField>

<ResponseField name="data" type="object">
  Coupon validation result

  <Expandable title="Properties">
    <ResponseField name="externalSessionId" type="string">
      External session identifier for tracking
    </ResponseField>

    <ResponseField name="status" type="string">
      Validation status: `Accepted` or error status
    </ResponseField>

    <ResponseField name="validationDate" type="string">
      Date and time when the coupon was validated (ISO 8601 format)
    </ResponseField>

    <ResponseField name="errorMessage" type="string">
      Error message if validation failed, empty string if successful
    </ResponseField>
  </Expandable>
</ResponseField>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Manual Flow" icon="hand" href="/integration-options/checkout-integration-app/manual-flow-in-pos-system-checkout-cmc">
    Implement manual widget selection flow
  </Card>

  <Card title="Checkout Integration Flow" icon="diagram-project" href="/integration-options/checkout-integration-app/checkout-integration-flow-example">
    View complete integration workflow
  </Card>

  <Card title="Transaction API" icon="arrow-right-arrow-left" href="/api-reference/transactions/introduction">
    Explore transaction endpoints
  </Card>

  <Card title="Coupon API" icon="ticket" href="/api-reference/coupons/introduction">
    Learn about coupon validation
  </Card>
</CardGroup>
