# Process anonymous Profile's checkout on POS

- Operation ID: `processAnonymousCheckout_POST`
- HTTP method: `POST`
- Path: `/v4/promotions/sale/process-anonymous-checkout`
- [Human-readable API reference](https://hub.synerise.com/api-reference/loyalty-and-engagement#tag/Promotions/operation/processAnonymousCheckout_POST)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /v4/promotions/sale/process-anonymous-checkout:
    post:
      tags:
        - Promotions
      summary: Process anonymous Profile's checkout on POS
      description: |
        Assign checkout handbill coupons for anonymous profile, based on items in basket and historical transactions.

        **IMPORTANT**: When assigning handbill promotions, candidate promotions are bounded by configurable limits: at most 40,000 candidates are read per handbill slot (ordered by priority), and the total number of candidates sent to the recommendation (AI) engine in a single request is capped at 45,000. If the combined candidates across all slots exceed the AI request cap, each slot is reduced proportionally to the number of candidates it contributed, but never below a configurable per-slot floor (default 1,000), so the smallest slots are left intact.


        ---

        **API consumers:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=profileLogin" target="_blank" rel="noopener">Workspace (Business Profile)</a>, <a href="/api-reference/authorization?tag=Authorization&amp;operationId=userLogin" target="_blank" rel="noopener">Synerise User</a>

        **API key permission required:** `PROMOTIONS_SALE_PROMOTIONS_READ`

        **User role permission required:** `campaigns_promotions: read`
      operationId: processAnonymousCheckout_POST
      security:
        - JWT: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - operationId
                - clientDateTime
                - terminal
                - transactionMetric
                - finalValue
                - transactionItems
                - transactionAdditionalItems
                - paymentsReport
              properties:
                operationId:
                  type: integer
                  description: Operation ID
                  nullable: false
                clientDateTime:
                  type: string
                  format: date-time
                  description: Operation's start time
                terminal:
                  type: object
                  description: Data about the terminal that is the transaction's source
                  required:
                    - storeId
                    - posId
                  properties:
                    storeId:
                      type: string
                      description: ID of the store
                    posId:
                      type: integer
                      description: ID of the point of sale (POS)
                transactionMetric:
                  type: object
                  description: Metadata of the transaction
                  required:
                    - posTransactionId
                    - beginDateTime
                    - globalTransactionId
                  properties:
                    posTransactionId:
                      type: integer
                      description: ID of the transaction within the POS
                    beginDateTime:
                      format: date-time
                      description: Time when the transaction starts
                    globalTransactionId:
                      type: string
                      description: Global transaction ID
                      nullable: true
                finalValue:
                  type: string
                  description: The total cost of all items in the basket, after discounts, including tax
                transactionItems:
                  type: array
                  items:
                    type: object
                    required:
                      - seqNo
                      - articleRef
                      - quantity
                      - evidPrice
                      - finalPrice
                      - finalValue
                    properties:
                      seqNo:
                        type: integer
                        description: Sequential number of transaction line item
                      articleRef:
                        type: string
                        description: Item's identifier in the product catalog
                      quantity:
                        type: string
                        description: Quantity of the product, provided to 3 decimal places
                        pattern: ^\d+(\.\d{1,3})?$
                        example: "3.231"
                      evidPrice:
                        type: string
                        description: Price per unit before discount, including tax
                        pattern: ^\d+\.\d{1,2}$
                        example: "34.23"
                      finalPrice:
                        type: string
                        description: Price per unit after discount, including tax
                        pattern: ^\d+\.\d{1,2}$
                        example: "30.23"
                      finalValue:
                        type: string
                        description: "The total cost of the product: `finalValue = finalPrice * quantity`"
                        pattern: ^\d+\.\d{1,2}$
                        example: "123.23"
                  description: Array of transaction items
                transactionAdditionalItems:
                  type: array
                  items:
                    type: object
                    required:
                      - seqNo
                      - type
                      - code
                    properties:
                      seqNo:
                        type: integer
                        description: Sequential number of additional item
                      type:
                        type: string
                        description: Type of the additional item
                        enum:
                          - COUPON
                      code:
                        type: string
                        description: Code of the additional item
                  description: Array of additional items in the transaction
                paymentsReport:
                  type: object
                  description: Payment information
                  required:
                    - paymentItems
                  properties:
                    paymentItems:
                      type: array
                      description: Array of payment methods information
                      items:
                        type: object
                        required:
                          - seqNo
                          - type
                          - name
                          - amount
                        properties:
                          seqNo:
                            type: integer
                            description: Sequential number of payment method
                          type:
                            type: integer
                            description: Type of payment method (id in external dictionary)
                          name:
                            type: string
                            description: Name of the payment method
                          amount:
                            type: string
                            description: Amount of payment
                          hashCode:
                            type: string
                            description: Hash code of payment method
      responses:
        "200":
          description: POS checkout processed
          content:
            application/json:
              schema:
                type: object
                properties:
                  responseCode:
                    type: number
                    description: Response code. 0 is the same as HTTP 200. Other HTTP codes are sent as usual.
                  responseDescription:
                    type: string
                    description: Description of the response. Used for diagnostics and troubleshooting.
                  operationId:
                    type: integer
                    description: Operation ID
                    nullable: false
                  clientDateTime:
                    type: string
                    format: date-time
                    description: Operation's start time
                  terminal:
                    type: object
                    description: Data about the terminal that is the transaction's source
                    required:
                      - storeId
                      - posId
                    properties:
                      storeId:
                        type: string
                        description: ID of the store
                      posId:
                        type: integer
                        description: ID of the point of sale (POS)
                  transactionGrantReport:
                    type: object
                    description: Report of printouts related to the transaction
                    properties:
                      printouts:
                        type: array
                        items:
                          type: object
                          properties:
                            source:
                              type: object
                              properties:
                                source:
                                  type: object
                                  description: Source of the discount
                                  required:
                                    - type
                                    - id
                                  properties:
                                    type:
                                      type: integer
                                      description: |
                                        
                                        By default:

                                        - `1` for promotions from your own database

                                        - `2` for promotions from your Synerise Workspace
                                    id:
                                      type: string
                                      description: ID of the promotion in the source domain, for example a promotion code
                                printoutType:
                                  type: string
                                  enum:
                                    - FREE_TEXT
                                    - COUPON
                                  description: Type of printout
                                printoutId:
                                  type: string
                                  description: ID of printout in source domain
                                text:
                                  type: string
                                  description: Printout information text. Default name of handbill configuration.
                                variables:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - CODE
                                        description: Type of variable attached to printout
                                      value:
                                        type: string
                                        description: Value of the variable. Eg. code of coupon.
        "400":
          description: Request body invalid/malformed/missing elements
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    title: JSON content issue
                    properties:
                      message:
                        type: string
                        description: Summary of the error
                      error:
                        description: Details of the error
                        anyOf:
                          - type: array
                            description: An array of objects with error details
                            items:
                              type: object
                              description: Details of an error
                              properties:
                                message:
                                  type: string
                                  description: Short description of the error
                                  example: Internal Error
                                additionalProperties:
                                  description: Additional information, if applicable
                          - type: string
                            description: Description of the error
                  - type: object
                    title: JSON structure issue
                    properties:
                      message:
                        type: string
                        description: Summary of the error
                      code:
                        type: string
                        description: String-type code of the error
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    description: HTTP code of the problem
                  error:
                    type: string
                    description: Summary of the error
                  message:
                    type: string
                    description: Error details
                  timestamp:
                    type: string
                    description: Time when the error occurred
        "403":
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    description: HTTP code of the problem
                  error:
                    type: string
                    description: Summary of the error
                  message:
                    type: string
                    description: Error details
                  timestamp:
                    type: string
                    description: Time when the error occurred
      x-snr-doc-urls:
        - /api-reference/loyalty-and-engagement#tag/Promotions/operation/processAnonymousCheckout_POST
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request POST \
              --url https://api.synerise.com/v4/promotions/sale/process-anonymous-checkout \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"operationId":0,"clientDateTime":"2019-08-24T14:15:22Z","terminal":{"storeId":"string","posId":0},"transactionMetric":{"posTransactionId":0,"beginDateTime":null,"globalTransactionId":"string"},"finalValue":"string","transactionItems":[{"seqNo":0,"articleRef":"string","quantity":"3.231","evidPrice":"34.23","finalPrice":"30.23","finalValue":"123.23"}],"transactionAdditionalItems":[{"seqNo":0,"type":"COUPON","code":"string"}],"paymentsReport":{"paymentItems":[{"seqNo":0,"type":0,"name":"string","amount":"string","hashCode":"string"}]}}'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            payload = "{\"operationId\":0,\"clientDateTime\":\"2019-08-24T14:15:22Z\",\"terminal\":{\"storeId\":\"string\",\"posId\":0},\"transactionMetric\":{\"posTransactionId\":0,\"beginDateTime\":null,\"globalTransactionId\":\"string\"},\"finalValue\":\"string\",\"transactionItems\":[{\"seqNo\":0,\"articleRef\":\"string\",\"quantity\":\"3.231\",\"evidPrice\":\"34.23\",\"finalPrice\":\"30.23\",\"finalValue\":\"123.23\"}],\"transactionAdditionalItems\":[{\"seqNo\":0,\"type\":\"COUPON\",\"code\":\"string\"}],\"paymentsReport\":{\"paymentItems\":[{\"seqNo\":0,\"type\":0,\"name\":\"string\",\"amount\":\"string\",\"hashCode\":\"string\"}]}}"

            headers = {
                'Authorization': "Bearer REPLACE_BEARER_TOKEN",
                'content-type': "application/json"
                }

            conn.request("POST", "/v4/promotions/sale/process-anonymous-checkout", payload, headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = JSON.stringify({
              "operationId": 0,
              "clientDateTime": "2019-08-24T14:15:22Z",
              "terminal": {
                "storeId": "string",
                "posId": 0
              },
              "transactionMetric": {
                "posTransactionId": 0,
                "beginDateTime": null,
                "globalTransactionId": "string"
              },
              "finalValue": "string",
              "transactionItems": [
                {
                  "seqNo": 0,
                  "articleRef": "string",
                  "quantity": "3.231",
                  "evidPrice": "34.23",
                  "finalPrice": "30.23",
                  "finalValue": "123.23"
                }
              ],
              "transactionAdditionalItems": [
                {
                  "seqNo": 0,
                  "type": "COUPON",
                  "code": "string"
                }
              ],
              "paymentsReport": {
                "paymentItems": [
                  {
                    "seqNo": 0,
                    "type": 0,
                    "name": "string",
                    "amount": "string",
                    "hashCode": "string"
                  }
                ]
              }
            });

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("POST", "https://api.synerise.com/v4/promotions/sale/process-anonymous-checkout");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");
            xhr.setRequestHeader("content-type", "application/json");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "POST",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/v4/promotions/sale/process-anonymous-checkout",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN",
                "content-type": "application/json"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.write(JSON.stringify({
              operationId: 0,
              clientDateTime: '2019-08-24T14:15:22Z',
              terminal: {storeId: 'string', posId: 0},
              transactionMetric: {posTransactionId: 0, beginDateTime: null, globalTransactionId: 'string'},
              finalValue: 'string',
              transactionItems: [
                {
                  seqNo: 0,
                  articleRef: 'string',
                  quantity: '3.231',
                  evidPrice: '34.23',
                  finalPrice: '30.23',
                  finalValue: '123.23'
                }
              ],
              transactionAdditionalItems: [{seqNo: 0, type: 'COUPON', code: 'string'}],
              paymentsReport: {
                paymentItems: [{seqNo: 0, type: 0, name: 'string', amount: 'string', hashCode: 'string'}]
              }
            }));
            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/v4/promotions/sale/process-anonymous-checkout');
            $request->setMethod(HTTP_METH_POST);

            $request->setHeaders([
              'Authorization' => 'Bearer REPLACE_BEARER_TOKEN',
              'content-type' => 'application/json'
            ]);

            $request->setBody('{"operationId":0,"clientDateTime":"2019-08-24T14:15:22Z","terminal":{"storeId":"string","posId":0},"transactionMetric":{"posTransactionId":0,"beginDateTime":null,"globalTransactionId":"string"},"finalValue":"string","transactionItems":[{"seqNo":0,"articleRef":"string","quantity":"3.231","evidPrice":"34.23","finalPrice":"30.23","finalValue":"123.23"}],"transactionAdditionalItems":[{"seqNo":0,"type":"COUPON","code":"string"}],"paymentsReport":{"paymentItems":[{"seqNo":0,"type":0,"name":"string","amount":"string","hashCode":"string"}]}}');

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.post("https://api.synerise.com/v4/promotions/sale/process-anonymous-checkout")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .header("content-type", "application/json")
              .body("{\"operationId\":0,\"clientDateTime\":\"2019-08-24T14:15:22Z\",\"terminal\":{\"storeId\":\"string\",\"posId\":0},\"transactionMetric\":{\"posTransactionId\":0,\"beginDateTime\":null,\"globalTransactionId\":\"string\"},\"finalValue\":\"string\",\"transactionItems\":[{\"seqNo\":0,\"articleRef\":\"string\",\"quantity\":\"3.231\",\"evidPrice\":\"34.23\",\"finalPrice\":\"30.23\",\"finalValue\":\"123.23\"}],\"transactionAdditionalItems\":[{\"seqNo\":0,\"type\":\"COUPON\",\"code\":\"string\"}],\"paymentsReport\":{\"paymentItems\":[{\"seqNo\":0,\"type\":0,\"name\":\"string\",\"amount\":\"string\",\"hashCode\":\"string\"}]}}")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: Promotions
components:
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      description: |-
        JWT Bearer token. The header looks like this: `Bearer {JWT}`

        Remember to include the space between 'Bearer' and the token.

        Generate a token via the **Authorization** endpoints.
```
