---
title: "Calculates prices for the given data and creates a transaction for the calculation."
url: "https://developer.migros.ch/apis/central-pricing-facade-1/versions/3d3408ff-7c6b-4890-82ea-373f6d4abb25/operations/createtransaction"
---

> Full API specification: https://developer.migros.ch/apis/central-pricing-facade-1/versions/3d3408ff-7c6b-4890-82ea-373f6d4abb25.md

# Calculates prices for the given data and creates a transaction for the calculation.

`POST` `/migros/sales/central-pricing/v1/{store}/transactions`

Operation ID: `createtransaction`

Business errors are documented at <a href="https://wiki.migros.net/x/Gb6cGw">https://wiki.migros.net/x/Gb6cGw</a>.

## Path parameters

- `store` (string, required) - Store which the calculation is based on

## Request body (required)

Content types: `application/json`

## Responses

- `200` - Successful calculation result
- `400` - Invalid data given

## OpenAPI definition

```yaml
openapi: 3.0.0
info:
  title: Central Pricing Facade
  version: 1.3.3.7
servers:
  - description: URL of upstream
    url: https://api.migros.ch
paths:
  /migros/sales/central-pricing/v1/{store}/transactions:
    post:
      description: Business errors are documented at <a
        href="https://wiki.migros.net/x/Gb6cGw">https://wiki.migros.net/x/Gb6cGw</a>.
      operationId: createtransaction
      parameters:
        - description: Store which the calculation is based on
          example: "0023200"
          in: path
          name: store
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Calculate"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
          description: Successful calculation result
        "400":
          $ref: "#/components/responses/400"
      summary: Calculates prices for the given data and creates a transaction for the
        calculation.
      tags:
        - central-pricing-facade
security:
  - Kong-Api-Key: []
components:
  schemas:
    Calculate:
      additionalProperties: false
      description: Request body for calculating prices.
      properties:
        coupons:
          description: List of coupon GTINs to take into account for the price calculation.
          items:
            example: "7613404420317"
            minLength: 4
            type: string
          type: array
        customer:
          description: Information about the customer and their loyalty.
          example:
            cumulus_number: "2099123123123"
            loyalty:
              - cumulus
          nullable: true
          oneOf:
            - $ref: "#/components/schemas/Customer"
        date:
          description: >-
            Date and time used for calculating the prices.


            This defaults to now but can be used to calculate prices based
            historic data.
          format: date-time
          nullable: true
          type: string
        products:
          description: List of products to calculate prices for.
          example:
            - product_id: "120299100000"
              quantity: 3
            - product_id: "101924500000"
              unit: KG
              weight: 3.5
          items:
            $ref: "#/components/schemas/ProductToCalculate"
          minItems: 1
          type: array
        ucbs:
          description: List of user coupon IDs (UCB) to take into account for the price
            calculation.
          items:
            example: "456456456"
            minLength: 4
            type: string
          type: array
      required:
        - products
      type: object
    Transaction:
      additionalProperties: false
      description: Response for finished transaction.
      properties:
        status_code:
          description: Status code if there was an error.
          nullable: true
          type: string
        transaction_id:
          description: ID of the transaction used for finishing it.
          example: 5oj548c9afa59304c0eb0b7f18b77c9c
          type: string
      required:
        - transaction_id
      type: object
    Customer:
      additionalProperties: false
      description: Information about the customer.
      properties:
        cumulus_number:
          description: Cumulus number of the customer.
          example: "2099123123123"
          maxLength: 40
          minLength: 10
          type: string
        loyalty:
          description: >-
            Loyalty programs the customer is part of.

            A person who uses the loyalty program `GKK` cannot use any of the
            other loyalty programs. Therefore the maxItems

            is set to 4, even though there are 5 loyalty programs in total.
          example:
            - cumulus
          items:
            enum:
              - cumulus
              - famigros
              - genossenschafter
              - migusto
              - gkk
            type: string
          maxItems: 4
          type: array
          uniqueItems: true
      required:
        - cumulus_number
      type: object
    ProductToCalculate:
      additionalProperties: false
      description: Product to calculate prices for.
      properties:
        price_per_unit:
          description: >-
            User-defined price per unit for the product.


            This can be used to override a price for a given product.

            If not set, the price will be looked up.

            The price is per unit of the product. Promotions are calculated
            based on this price.
          example: 1.75
          format: float
          minimum: 0
          nullable: true
          type: number
        product_id:
          description: ID of the product.
          example: "101924500000"
          maxLength: 40
          minLength: 9
          type: string
        quantity:
          description: |-
            Number of products.

            This is not used for weight-based products.
          example: 1
          exclusiveMinimum: true
          minimum: 0
          nullable: true
          type: integer
        unit:
          description: |-
            User-defined unit for the product.

            This can be used to override the unit for a given product.
            If not set, the unit will be looked up.
          enum:
            - CU
            - KG
            - M
            - QM
          example: CU
          nullable: true
          type: string
        weight:
          description: >-
            Total weight of the product.


            This is only used for weight-based products. Set the `unit` field to
            "KG" when overwriting the weight.
          example: 125.2
          exclusiveMinimum: true
          format: float
          minimum: 0
          nullable: true
          type: number
      required:
        - product_id
      type: object
    problem:
      description: Problem Details for HTTP APIs defined by RFC 7807
      properties:
        detail:
          example: More details
          type: string
        status:
          example: 400
          type: integer
        title:
          example: Test error
          type: string
        validation-errors:
          items:
            properties:
              constraint:
                example: minLength
                type: string
              message:
                example: Example error
                type: string
              pointer:
                example: /prop1/0
                type: string
              property:
                example: prop1[0]
                type: string
            required:
              - property
              - pointer
              - message
              - constraint
            type: object
          minItems: 1
          type: array
      required:
        - status
        - title
      title: Problem Details
      type: object
  responses:
    "400":
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/problem"
      description: Invalid data given
  securitySchemes:
    Kong-Api-Key:
      description: Kong key-auth authentication
      in: header
      name: X-Api-Key
      type: apiKey
```
