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

# Get Discounts

> Gets applicable discounts for a transaction. The discounts are categorized as <br /> 1) **Transaction-level discounts**: Applied on the whole transaction. For example, if the transaction is for $100, the discount is applied by percentage or amount to the whole transaction amount. This category includes tier-specific discounts. <br /> 2) **Item-level discounts**: Applied on specific SKU so that discount percentage or amount is applied to specific product (regardless of the quantity). <br /> 3) **Miscellaneous discounts** - This category captures all other types of discounts.



## OpenAPI

````yaml member post /v1/discounts
openapi: 3.0.1
info:
  title: Loyalty (Member)
  description: >-
    fabric **Loyalty** formerly **Member** is a Loyalty Management System (LMS)
    that enables marketers to create multiple loyalty strategies under a loyalty
    program to cater to various businesses and customer segments. <br />
    **Member overview**: <br /> During onboarding, you are given the necessary
    **credentials** (client_id and client_secret) to obtain an access token,
    which is required to run every call. Membership hierarchy is organized into
    Programs, Clubs, and Tiers. <br /> **Program** is the first hierarchy level
    and is where rewards and benefits are configured for the organization. <br
    /> **Club** is the second hierarchy level and is where Rules for the program
    are configured. <br />Each Club must have at least one **Tier**, which is
    used to define membership and to configure criteria and thresholds
    (including free vs paid). Additional hierarchy levels can be added to
    support the needs of your business.  <br /> Members are always enrolled into
    a **Default Tier** within a club. When members make purchases, they earn
    Points based on the rules set at the club level and/or based on promotions.
    When points in a member account reach a predefined **Threshold Value**,
    points are converted to **Rewards**. This conversion may be manual or
    automatic depending on the program configuration. Members can **Redeem**
    their rewards within the reward **Expiry Period**. Account point balances
    are updated after each point-impacting activity.
  version: 1.0.0
  contact:
    email: support@fabric.inc
  license:
    name: fabric Inc
    url: https://fabric.inc
servers:
  - url: https://vanilla-dev02-loyalty.fabric.zone/api
    description: For developers to work outside of the production environment.
  - url: https://vanilla-stg-loyalty.fabric.zone/api
    description: Replica of the production environment for testing.
  - url: https://loyalty-sbx.fabric.zone/api
    description: >-
      An isolated testing environment (UAT) to run programs without affecting
      the application, system or platform on which they run.
  - url: https://loyalty.fabric.zone/api
    description: Production environment.
security:
  - bearerAuth: []
paths:
  /v1/discounts:
    post:
      tags:
        - Discounts
      summary: Get Discounts
      description: >-
        Gets applicable discounts for a transaction. The discounts are
        categorized as <br /> 1) **Transaction-level discounts**: Applied on the
        whole transaction. For example, if the transaction is for $100, the
        discount is applied by percentage or amount to the whole transaction
        amount. This category includes tier-specific discounts. <br /> 2)
        **Item-level discounts**: Applied on specific SKU so that discount
        percentage or amount is applied to specific product (regardless of the
        quantity). <br /> 3) **Miscellaneous discounts** - This category
        captures all other types of discounts.
      operationId: discounts_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DiscountRequest'
        required: true
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DiscountAPIResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericResponseClass1'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericResponseClass2'
components:
  schemas:
    DiscountRequest:
      required:
        - entityReference
        - grossAmount
        - netAmount
        - profileId
        - taxAmount
        - transactionTimestamp
      type: object
      properties:
        profileId:
          title: Profileid
          type: string
          description: Profile ID of member
          example: 67460e74-02e3-11e8-b443-00163e990bdb
          format: uuid
        entityReference:
          title: Entityreference
          minLength: 1
          type: string
          description: External reference of the store where the transaction occurred
          example: Company_Club
        transactionTimestamp:
          title: Transactiontimestamp
          type: string
          description: Transaction timestamp (UTC format)
          example: '2020-02-08 09:30:26'
          format: date-time
        taxAmount:
          title: Taxamount
          type: number
          format: float
          description: Tax amount
          example: 1
        grossAmount:
          title: Grossamount
          type: number
          format: float
          description: Gross amount of the transaction (before discount)
          example: 6
        netAmount:
          title: Netamount
          type: number
          format: float
          description: Net amount of the transaction (after discount).
          example: 5
        transactionItems:
          type: array
          items:
            $ref: '#/components/schemas/DiscountRequestTransactionItems'
    DiscountAPIResponse:
      type: object
      description: Response of the Discounts API
      properties:
        status:
          title: Status
          description: Status of the call
          type: integer
          example: 200
          format: int32
        message:
          title: Message
          description: Message corresponding to the call
          example: Created
          type: string
          default: Exception message
        errors:
          title: Errors
          description: Error details, if applicable
          type: object
          properties: {}
          example: {}
        data:
          title: Data
          type: array
          items:
            $ref: '#/components/schemas/DiscountResponseDetails'
    GenericResponseClass1:
      type: object
      description: Bad request
      properties:
        message:
          title: Message
          minLength: 1
          type: string
          description: Message corresponding to the call.
          example: Error message string
        errors:
          title: Errors
          type: object
          properties: {}
          description: A dictionary of lists with different number of errors or exceptions.
          example:
            ExceptionString:
              - Invalid Field
        data:
          title: Data
          type: object
          properties: {}
          description: Returns data in the form of a list of dictionaries or null
          example: null
        status:
          title: Status
          type: integer
          description: Status code of the call
          example: 400
          format: int32
    GenericResponseClass2:
      type: object
      description: Unauthorized
      properties:
        detail:
          title: Detail
          type: string
          description: Message corresponding to the response
          example: Authentication Failed
    DiscountRequestTransactionItems:
      required:
        - SKU
        - categories
        - grossAmount
        - itemPrice
        - itemQuantity
        - netAmount
      type: object
      description: Item details
      properties:
        grossAmount:
          title: Grossamount
          type: number
          format: float
          description: Transaction gross amount
          example: 6
        taxAmount:
          title: Taxamount
          type: number
          format: float
          description: Tax amount
          example: 1
        netAmount:
          title: Netamount
          type: number
          format: float
          description: Net amount of transaction
          example: 5
        categories:
          type: array
          items:
            type: string
          description: List of item categories
          example:
            - Proteins
            - Adults
          minLength: 1
        itemName:
          title: Itemname
          minLength: 1
          type: string
          description: Item name
          example: Whey
        itemPrice:
          title: Itemprice
          type: integer
          description: Item price
          example: 5
          format: int32
        itemQuantity:
          title: Itemquantity
          type: integer
          description: Item quantity
          example: 1
          format: int32
        SKU:
          title: Sku
          maxLength: 100
          minLength: 1
          type: string
          description: Stock Keeping Unit (SKU) of item
          example: '123456'
    DiscountResponseDetails:
      type: object
      properties:
        grossAmount:
          title: Grossamount
          type: number
          format: float
          description: Gross amount of transaction (before discount)
          example: 6
        taxAmount:
          title: Taxamount
          type: number
          format: float
          description: Tax amount on transaction
          example: 1
        netAmount:
          title: Netamount
          type: number
          format: float
          description: Net amount of transaction (after discount).
          example: 4
        discounts:
          type: array
          items:
            $ref: '#/components/schemas/DiscountDetails'
        transactionItems:
          type: array
          items:
            $ref: '#/components/schemas/DiscountTransactionItemsResponse'
        miscellaneous:
          type: array
          items:
            type: object
            properties: {}
          example: []
    DiscountDetails:
      required:
        - value
      type: object
      properties:
        type:
          title: Type
          minLength: 1
          type: string
          description: Discount type
          example: tier
        description:
          title: Description
          minLength: 1
          type: string
          description: Description of the discount
          example: 20.0% discount from tier rule.
        value:
          title: Value
          type: number
          format: float
          description: Monetary value of discount
          example: 1
        id:
          title: Id
          type: integer
          description: Discount ID
          example: 23
          format: int32
        ruleName:
          title: Rulename
          type: string
          description: Name of the discount-rule
          example: tier-discount-rule
        discountPercentage:
          title: Discountpercentage
          type: number
          format: float
          description: Percentage value of the discount
          example: 20
        discountAmount:
          title: Discountamount
          type: number
          format: float
          description: Monetary value of the discount
          example: 1
    DiscountTransactionItemsResponse:
      type: object
      properties:
        SKU:
          title: Sku
          minLength: 1
          type: string
          description: Stock Keeping Unit (SKU) of item
          example: '123456'
        discounts:
          type: array
          items:
            $ref: '#/components/schemas/DiscountDetails'
          example: []
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````