---
title: "Calculate"
url: "https://developer.migros.ch/apis/central-pricing-facade-1/versions/3d3408ff-7c6b-4890-82ea-373f6d4abb25/schemas/Calculate"
---

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

# Calculate

Request body for calculating prices.

## 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
components:
  schemas:
    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
    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
```
