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

# Loads purchase.

> Tries to enrich original request with memberId from LoyaltyCard service, if loyaltyCardId has value and memberId is null, then saves the purchase.



## OpenAPI

````yaml openapi/purchase-v1.json POST /v1/purchases
openapi: 3.0.1
info:
  title: PurchaseLoad.Api
  description: "Enabler service for storing POS transactions (purchases). Enables other services to have purchase-triggered logic via subscription\r\n                                        to message broker topic. (e.g. Bonus Calculation service listens to 'PurchaseLoadedEvent' in order to calculate and \r\n                                        load bonus to member's bonus account for each member's purchase. There are separate topics for member and non-member purchases. "
  version: v1
servers:
  - url: https://{host}/purchase
    description: Your Lobyco environment
    variables:
      host:
        default: your-environment.lobyco.net
        description: >-
          The API host for your Lobyco environment. Replace it with the host you
          were given — this placeholder does not resolve.
security: []
paths:
  /v1/purchases:
    post:
      tags:
        - Purchases
      summary: Loads purchase.
      description: >-
        Tries to enrich original request with memberId from LoyaltyCard service,
        if loyaltyCardId has value and memberId is null, then saves the
        purchase.
      requestBody:
        description: The purchase data.
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/PurchaseLoad.Api.CQRS.Commands.LoadPurchase.LoadPurchaseCommand
            examples:
              Non-member purchase:
                value:
                  receiptId: '26081000216995750172'
                  storeId: '216995'
                  currencyCode: EUR
                  totalAmount: 1809.3
                  totalTaxAmount: 179.3
                  purchaseDateTimeUtc: '2026-08-10T09:58:03.0187504Z'
                  purchaseBusinessDateTime: '2026-08-10T11:58:03.0187504'
                  paymentMethods:
                    - amount: 1809.3
                      paymentType: Cash
                  products:
                    - id: '10992265'
                      sequenceNumber: 1
                      name: Some fancy product
                      categoryId: '48810'
                      unitPrice: 1809.3
                      quantity:
                        unitOfMeasure: Kg
                        value: 1
                      originalPrice: 1809.3
                      price: 1809.3
                  discounts: []
                  taxes:
                    - taxableAmount: 1630
                      amount: 179.3
                      percentage: 0.11
                  paymentLocation: test
              Member purchase:
                value:
                  receiptId: '26081000216995626539'
                  storeId: '216995'
                  memberId: '707844'
                  currencyCode: EUR
                  totalAmount: 100
                  totalTaxAmount: 8.67
                  purchaseDateTimeUtc: '2026-08-10T09:58:03.0188367Z'
                  purchaseBusinessDateTime: '2026-08-10T11:58:03.0188367'
                  paymentMethods:
                    - amount: 90
                      paymentType: Card
                      cardPan: 4441XXXXXXXX1234
                    - amount: 10
                      paymentType: LoyaltyApp
                  products:
                    - id: '548189901'
                      sequenceNumber: 1
                      name: Some fancy product
                      categoryId: '21527'
                      unitPrice: 50
                      quantity:
                        unitOfMeasure: Kg
                        value: 0.5
                      originalPrice: 25
                      price: 25
                    - id: '24648103'
                      sequenceNumber: 2
                      name: Some other fancy product
                      categoryId: '73852'
                      unitPrice: 75
                      quantity:
                        unitOfMeasure: EA
                        value: 1
                      originalPrice: 75
                      price: 75
                  discounts: []
                  taxes:
                    - taxableAmount: 23.15
                      amount: 1.85
                      percentage: 0.08
                    - taxableAmount: 68.18
                      amount: 6.82
                      percentage: 0.1
              Purchase with loyalty card:
                value:
                  receiptId: '26081000216995771140'
                  storeId: '216995'
                  loyaltyCardId: '852151'
                  currencyCode: EUR
                  totalAmount: 2.75
                  totalTaxAmount: 0.05
                  purchaseDateTimeUtc: '2026-08-10T09:58:03.0188503Z'
                  purchaseBusinessDateTime: '2026-08-10T11:58:03.0188504'
                  paymentMethods:
                    - amount: 2.75
                      paymentType: LoyaltyApp
                  products:
                    - id: '989362680'
                      sequenceNumber: 1
                      name: Some product
                      categoryId: '52569'
                      unitPrice: 2.75
                      quantity:
                        unitOfMeasure: EA
                        value: 1
                      originalPrice: 2.75
                      price: 2.75
                  discounts: []
                  taxes:
                    - taxableAmount: 2.7
                      amount: 0.05
                      percentage: 0.02
                  paymentLocation: test
              Purchase with product discounts:
                value:
                  receiptId: '26081000216995757101'
                  storeId: '216995'
                  memberId: '707844'
                  currencyCode: EUR
                  totalAmount: 4
                  totalTaxAmount: 0.36
                  purchaseDateTimeUtc: '2026-08-10T09:58:03.0188591Z'
                  purchaseBusinessDateTime: '2026-08-10T11:58:03.0188591'
                  paymentMethods:
                    - amount: 4
                      paymentType: Cash
                  products:
                    - id: '208975612'
                      sequenceNumber: 1
                      name: Some product
                      categoryId: '41421'
                      unitPrice: 10
                      quantity:
                        unitOfMeasure: EA
                        value: 1
                      originalPrice: 10
                      price: 3
                    - id: '872408504'
                      sequenceNumber: 2
                      name: Some other product
                      categoryId: '32031'
                      unitPrice: 2
                      quantity:
                        unitOfMeasure: EA
                        value: 1
                      originalPrice: 2
                      price: 1
                  discounts:
                    - name: 70% discount
                      totalDiscountAmount: 7
                      appliedProducts:
                        - 1
                    - name: 50% discount
                      totalDiscountAmount: 1
                      appliedProducts:
                        - 2
                  taxes:
                    - taxableAmount: 3.64
                      amount: 0.36
                      percentage: 0.1
              Purchase with global discount:
                value:
                  receiptId: '26081000216995450444'
                  storeId: '216995'
                  memberId: '707844'
                  currencyCode: EUR
                  totalAmount: 6
                  totalTaxAmount: 0.92
                  purchaseDateTimeUtc: '2026-08-10T09:58:03.0188749Z'
                  purchaseBusinessDateTime: '2026-08-10T11:58:03.0188749'
                  paymentMethods:
                    - amount: 6
                      paymentType: Card
                      cardPan: 4441XXXXXXXX1234
                  products:
                    - id: '627299367'
                      sequenceNumber: 1
                      name: Some product
                      categoryId: '41574'
                      unitPrice: 10
                      quantity:
                        unitOfMeasure: EA
                        value: 1
                      originalPrice: 10
                      price: 5
                    - id: '685050382'
                      sequenceNumber: 2
                      name: Some other product
                      categoryId: '382'
                      unitPrice: 2
                      quantity:
                        unitOfMeasure: EA
                        value: 1
                      originalPrice: 2
                      price: 1
                  discounts:
                    - name: 50% all products discount
                      totalDiscountAmount: 6
                  taxes:
                    - taxableAmount: 4.17
                      amount: 0.83
                      percentage: 0.2
                    - taxableAmount: 0.91
                      amount: 0.09
                      percentage: 0.1
              Purchase with currency conversion:
                value:
                  receiptId: '26081000216995647502'
                  storeId: '216995'
                  currencyCode: EUR
                  totalAmount: 82.61
                  totalTaxAmount: 6.82
                  purchaseDateTimeUtc: '2026-08-10T09:58:03.018886Z'
                  purchaseBusinessDateTime: '2026-08-10T11:58:03.018886'
                  paymentMethods:
                    - amount: 100
                      currencyCode: USD
                      conversionRate: 0.8261
                      paymentType: Cash
                  products:
                    - id: '658946395'
                      sequenceNumber: 1
                      name: Some expensive product
                      categoryId: '61475'
                      unitPrice: 12.99
                      quantity:
                        unitOfMeasure: Kg
                        value: 6.359
                      originalPrice: 82.61
                      price: 82.61
                  discounts: []
                  taxes:
                    - taxableAmount: 75.79
                      amount: 6.82
                      percentage: 0.09
              Purchase with returned product:
                value:
                  receiptId: '26081000216995967263'
                  storeId: '216995'
                  memberId: '707844'
                  currencyCode: EUR
                  totalAmount: 10
                  totalTaxAmount: 0
                  purchaseDateTimeUtc: '2026-08-10T09:58:03.0188945Z'
                  purchaseBusinessDateTime: '2026-08-10T11:58:03.0188946'
                  paymentMethods:
                    - amount: 10
                      paymentType: Cash
                  products:
                    - id: '542614217'
                      sequenceNumber: 1
                      name: Some product
                      categoryId: '62727'
                      unitPrice: 7.5
                      quantity:
                        unitOfMeasure: EA
                        value: 2
                      originalPrice: 15
                      price: 15
                    - id: '274589484'
                      sequenceNumber: 2
                      name: Some other product
                      categoryId: '31507'
                      originalReceiptId: '26081000216995140553'
                      unitPrice: 5
                      quantity:
                        unitOfMeasure: EA
                        value: -1
                      originalPrice: -5
                      price: -5
                  discounts: []
                  taxes: []
              Purchase with shipping details:
                value:
                  receiptId: '2608100021699583197'
                  storeId: '216995'
                  memberId: '707844'
                  currencyCode: EUR
                  totalAmount: 7
                  totalTaxAmount: 0.83
                  purchaseDateTimeUtc: '2026-08-10T09:58:03.0189031Z'
                  purchaseBusinessDateTime: '2026-08-10T11:58:03.0189032'
                  paymentMethods:
                    - amount: 7
                      paymentType: Cash
                  products:
                    - id: '735434482'
                      sequenceNumber: 1
                      name: Some expensive product
                      categoryId: '17205'
                      unitPrice: 7
                      quantity:
                        unitOfMeasure: EA
                        value: 1
                      originalPrice: 7
                      price: 7
                  discounts: []
                  taxes:
                    - taxableAmount: 4.17
                      amount: 0.83
                      percentage: 0.2
                  shipping:
                    refundAsBonus: false
                    totalAmount: 2
              Purchase with products where tax is not included in price:
                value:
                  receiptId: '26081000216995449732'
                  storeId: '216995'
                  memberId: '707844'
                  currencyCode: EUR
                  totalAmount: 1809.3
                  totalTaxAmount: 301.55
                  purchaseDateTimeUtc: '2026-08-10T09:58:03.0189123Z'
                  purchaseBusinessDateTime: '2026-08-10T11:58:03.0189123'
                  paymentMethods:
                    - amount: 1809.3
                      paymentType: Cash
                  products:
                    - id: '295466688'
                      sequenceNumber: 1
                      name: Some VAT taxable product
                      categoryId: '94516'
                      unitPrice: 1507.75
                      quantity:
                        unitOfMeasure: Kg
                        value: 1
                      originalPrice: 1507.75
                      price: 1507.75
                      taxIncludedInPrice: false
                      taxes:
                        - type: VAT
                          taxableAmount: 1507.75
                          amount: 301.55
                          percentage: 0.2
                  discounts: []
                  taxes:
                    - type: VAT
                      taxableAmount: 1507.75
                      amount: 301.55
                      percentage: 0.2
                  paymentLocation: test
              Purchase with rounding in payment method:
                value:
                  receiptId: '26081000216995514780'
                  storeId: '216995'
                  memberId: '707844'
                  currencyCode: EUR
                  totalAmount: 27.29
                  totalTaxAmount: 1.3
                  purchaseDateTimeUtc: '2026-08-10T09:58:03.0189209Z'
                  purchaseBusinessDateTime: '2026-08-10T11:58:03.018921'
                  paymentMethods:
                    - amount: 27.3
                      paymentType: Cash
                      rounding: -0.01
                  products:
                    - id: '881874899'
                      sequenceNumber: 1
                      name: Some VAT taxable product
                      categoryId: '22646'
                      unitPrice: 25.99
                      quantity:
                        unitOfMeasure: Kg
                        value: 1
                      originalPrice: 25.99
                      price: 25.99
                      taxIncludedInPrice: false
                      taxes:
                        - type: VAT
                          taxableAmount: 25.99
                          amount: 1.3
                          percentage: 0.05
                  discounts: []
                  taxes:
                    - type: VAT
                      taxableAmount: 25.99
                      amount: 1.3
                      percentage: 0.05
                  paymentLocation: test
              Purchase with not predefined payment method:
                value:
                  receiptId: '26081000216995646717'
                  storeId: '216995'
                  memberId: '707844'
                  currencyCode: EUR
                  totalAmount: 100
                  totalTaxAmount: 8.67
                  purchaseDateTimeUtc: '2026-08-10T09:58:03.0189286Z'
                  purchaseBusinessDateTime: '2026-08-10T11:58:03.0189286'
                  paymentMethods:
                    - amount: 90
                      paymentType: Card
                      cardPan: 4441XXXXXXXX1234
                    - amount: 10
                      paymentType: Other
                      displayName: Gift Card
                  products:
                    - id: '301960597'
                      sequenceNumber: 1
                      name: Some fancy product
                      categoryId: '67231'
                      unitPrice: 50
                      quantity:
                        unitOfMeasure: Kg
                        value: 0.5
                      originalPrice: 25
                      price: 25
                    - id: '877936514'
                      sequenceNumber: 2
                      name: Some other fancy product
                      categoryId: '28723'
                      unitPrice: 75
                      quantity:
                        unitOfMeasure: EA
                        value: 1
                      originalPrice: 75
                      price: 75
                  discounts: []
                  taxes:
                    - taxableAmount: 23.15
                      amount: 1.85
                      percentage: 0.08
                    - taxableAmount: 68.18
                      amount: 6.82
                      percentage: 0.1
              Purchase with metadata:
                value:
                  receiptId: '26081000216995528739'
                  storeId: '216995'
                  memberId: '707844'
                  currencyCode: EUR
                  totalAmount: 92
                  totalTaxAmount: 8.67
                  purchaseDateTimeUtc: '2026-08-10T09:58:03.0189385Z'
                  purchaseBusinessDateTime: '2026-08-10T11:58:03.0189385'
                  paymentMethods:
                    - amount: 90
                      paymentType: Card
                      cardPan: 4441XXXXXXXX1234
                      metadata:
                        terminal: AB123456
                        merchant: PF123345
                        cardType: Visa Debit
                    - amount: 2
                      paymentType: LoyaltyApp
                  products:
                    - id: '503598433'
                      sequenceNumber: 1
                      name: Some fancy product
                      categoryId: '4502'
                      unitPrice: 50
                      quantity:
                        unitOfMeasure: Kg
                        value: 0.5
                      originalPrice: 25
                      price: 18
                    - id: '967179949'
                      sequenceNumber: 2
                      name: Some other fancy product
                      categoryId: '14900'
                      unitPrice: 75
                      quantity:
                        unitOfMeasure: EA
                        value: 1
                      originalPrice: 75
                      price: 74
                      metadata:
                        displayQuantityOnReceipt: false
                  discounts:
                    - name: 70% discount
                      totalDiscountAmount: 7
                      appliedProducts:
                        - 1
                      metadata:
                        type: '01'
                    - name: 50% discount
                      totalDiscountAmount: 1
                      appliedProducts:
                        - 2
                      metadata:
                        type: '02'
                  taxes:
                    - taxableAmount: 23.15
                      amount: 1.85
                      percentage: 0.08
                    - taxableAmount: 68.18
                      amount: 6.82
                      percentage: 0.1
                  metadata:
                    sponsorStickers: 2
                    transactionStickers: '3'
      responses:
        '200':
          description: OK
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/LoopFoundation.Commons.Contracts.WebServiceError
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/LoopFoundation.Commons.Contracts.WebServiceError
components:
  schemas:
    PurchaseLoad.Api.CQRS.Commands.LoadPurchase.LoadPurchaseCommand:
      required:
        - currencyCode
        - products
        - purchaseBusinessDateTime
        - purchaseDateTimeUtc
        - receiptId
        - storeId
        - totalAmount
        - totalTaxAmount
      type: object
      properties:
        receiptId:
          maxLength: 64
          minLength: 1
          type: string
          description: "Globally unique purchase ID.\r\nit's recommended  to compose it based on transaction date and time, store ID, and POS ID.\r\nRecommended pattern: {yyyymmdd}{hhmmss}{ssss}{ppp}, where sss - store ID, ppp - POS ID.\r\nExample: 202307101706440023011"
        storeId:
          maxLength: 128
          minLength: 1
          type: string
          description: Id of store where payment is done.
        memberId:
          maxLength: 36
          type: string
          description: Id of member who performed purchase.
          nullable: true
        externalDiscountCardId:
          type: string
          description: "The identifier for an external discount card that is not linked to the loyalty app.\r\nBy default, this field should be empty. If populated, then bonus calculation will be skipped as the customer has received external benefits."
          nullable: true
        loyaltyCardId:
          maxLength: 36
          type: string
          description: "Identifier for the loyalty card. \r\nUsed for member identification if this value is provided but memberId is not specified."
          nullable: true
        orderId:
          type: string
          description: "Order identifier, whithin which the partial receipt was generated.\r\nThis field is related to e-commerce transactions."
          nullable: true
        currencyCode:
          maxLength: 3
          minLength: 3
          type: string
          description: "Local store currency code.\r\nISO-4217 currency code - 3 characters, for example, DKK, ISK, EUR etc."
        totalAmount:
          type: number
          description: "Total price of purchased products with discounts and taxes applied.\r\nCan be negative in case when total price of returned items is greater than total price of purchased items.\r\nDecimal amount with '.' as float separator.\r\n Example: 105.55"
          format: double
        amountForBonusCalculation:
          type: number
          description: "The total amount used for calculating bonuses. This amount excludes items like lottery, tobacco, alcohol products.\r\nBy default, this field should not be passed, so that Bonus Calculation service automatically excludes ineligible products.\r\nIf passed, this value will be used to calculate the basket-level bonus.\r\nThe value should be a decimal with '.' as the separator (e.g., 10.25)."
          format: double
          nullable: true
        totalTaxAmount:
          type: number
          description: "Total amount of taxes (VAT) included in price.\r\nThis amount should be included in PurchaseLoad.Api.CQRS.Commands.LoadPurchase.LoadPurchaseCommand.TotalAmount.\r\nDecimal amount with '.' as float separator."
          format: double
        purchaseDateTimeUtc:
          type: string
          description: "Date and time of the purchase in UTC.\r\n Example:'2020-04-14T11:00:00Z'."
          format: date-time
        purchaseBusinessDateTime:
          type: string
          description: "Date and time of the purchase in store local timezone.\r\n Example:'2020-04-14T13:00:00'."
          format: date-time
        paymentMethods:
          type: array
          items:
            $ref: '#/components/schemas/PurchaseLoad.Contract.Common.PaymentMethod'
          description: All payment methods which user used to cover the purchase.
          nullable: true
        products:
          type: array
          items:
            $ref: '#/components/schemas/PurchaseLoad.Contract.Common.Product'
          description: The list of purchased products.
        discounts:
          type: array
          items:
            $ref: '#/components/schemas/PurchaseLoad.Contract.Common.Discount'
          description: "List of discounts applied to purchase/products.\r\nOptional. If no discounts were applied it should be missed."
          nullable: true
        taxes:
          type: array
          items:
            $ref: '#/components/schemas/PurchaseLoad.Contract.Common.Tax'
          description: List of summarized tax details.
          nullable: true
        shipping:
          $ref: '#/components/schemas/PurchaseLoad.Contract.Common.ShippingInfo'
        paymentLocation:
          type: string
          description: >-
            Unique identifier of POS in Lobyco payment service. Recommended
            pattern is '{storeId}_{posId}'.
          nullable: true
        metadata:
          type: object
          additionalProperties: {}
          description: "Set of key-value pairs that you can attach to an object. \r\nThis can be useful for storing additional client-specific information about the object in a structured format. \r\nBy default, this field should be skipped, unless otherwise agreed upon during integration."
          nullable: true
        checkoutType:
          $ref: '#/components/schemas/PurchaseLoad.Contract.Common.CheckoutType'
        posId:
          type: string
          description: Id of POS where payment was done
          nullable: true
        phone:
          type: string
          description: Member's phone number
          nullable: true
      additionalProperties: false
    LoopFoundation.Commons.Contracts.WebServiceError:
      required:
        - message
        - name
      type: object
      properties:
        name:
          minLength: 1
          type: string
        message:
          minLength: 1
          type: string
        details:
          nullable: true
      additionalProperties: false
    PurchaseLoad.Contract.Common.PaymentMethod:
      type: object
      properties:
        amount:
          type: number
          format: double
        currencyCode:
          type: string
          nullable: true
        conversionRate:
          type: number
          format: double
          nullable: true
        paymentType:
          $ref: '#/components/schemas/PurchaseLoad.Contract.Common.PaymentType'
        cardPan:
          type: string
          nullable: true
        rounding:
          type: number
          format: double
          nullable: true
        displayName:
          type: string
          nullable: true
        metadata:
          type: object
          additionalProperties: {}
          nullable: true
      additionalProperties: false
    PurchaseLoad.Contract.Common.Product:
      type: object
      properties:
        id:
          type: string
          nullable: true
        sequenceNumber:
          type: integer
          format: int32
        name:
          type: string
          nullable: true
        categoryId:
          type: string
          nullable: true
        originalReceiptId:
          type: string
          nullable: true
        disposalItem:
          $ref: '#/components/schemas/PurchaseLoad.Contract.Common.DisposalItem'
        unitPrice:
          type: number
          format: double
          nullable: true
        quantity:
          $ref: '#/components/schemas/PurchaseLoad.Contract.Common.Quantity'
        originalPrice:
          type: number
          format: double
        price:
          type: number
          format: double
        isReturned:
          type: boolean
          nullable: true
        isCancelled:
          type: boolean
          nullable: true
        taxIncludedInPrice:
          type: boolean
          nullable: true
        taxes:
          type: array
          items:
            $ref: '#/components/schemas/PurchaseLoad.Contract.Common.Tax'
          nullable: true
        metadata:
          type: object
          additionalProperties: {}
          nullable: true
        discountAllocations:
          type: array
          items:
            $ref: >-
              #/components/schemas/PurchaseLoad.Contract.Common.DiscountAllocation
          nullable: true
      additionalProperties: false
    PurchaseLoad.Contract.Common.Discount:
      type: object
      properties:
        sequenceNumber:
          type: integer
          format: int32
          nullable: true
        name:
          type: string
          nullable: true
        totalDiscountAmount:
          type: number
          format: double
        couponId:
          type: string
          nullable: true
          deprecated: true
        couponIds:
          type: array
          items:
            type: string
          nullable: true
        appliedProducts:
          type: array
          items:
            type: integer
            format: int32
          nullable: true
        metadata:
          type: object
          additionalProperties: {}
          nullable: true
      additionalProperties: false
    PurchaseLoad.Contract.Common.Tax:
      type: object
      properties:
        type:
          type: string
          nullable: true
        taxableAmount:
          type: number
          format: double
          nullable: true
        amount:
          type: number
          format: double
        percentage:
          type: number
          format: double
          nullable: true
      additionalProperties: false
    PurchaseLoad.Contract.Common.ShippingInfo:
      type: object
      properties:
        refundAsBonus:
          type: boolean
        totalAmount:
          type: number
          format: double
      additionalProperties: false
    PurchaseLoad.Contract.Common.CheckoutType:
      enum:
        - Pos
        - SelfCheckout
        - ScanAndPay
        - Online
      type: string
    PurchaseLoad.Contract.Common.PaymentType:
      enum:
        - Card
        - Cash
        - LoyaltyApp
        - Other
      type: string
    PurchaseLoad.Contract.Common.DisposalItem:
      type: object
      properties:
        name:
          type: string
          nullable: true
        unitPrice:
          type: number
          format: double
        quantity:
          $ref: '#/components/schemas/PurchaseLoad.Contract.Common.Quantity'
        totalAmount:
          type: number
          format: double
      additionalProperties: false
    PurchaseLoad.Contract.Common.Quantity:
      type: object
      properties:
        unitOfMeasure:
          type: string
          nullable: true
        value:
          type: number
          format: double
      additionalProperties: false
    PurchaseLoad.Contract.Common.DiscountAllocation:
      type: object
      properties:
        discountSequenceNumber:
          type: integer
          format: int32
        discountAmount:
          type: number
          format: double
      additionalProperties: false

````