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

# Check discount code validity



## OpenAPI

````yaml /loyalty/admin-api-swagger.json put /api/external/check-discount
openapi: 3.0.1
info:
  description: ''
  title: Admin APIs
  version: 0.0.1
servers:
  - url: https://loyalty-admin.appstle.com
security: []
tags:
  - description: >-
      Admin APIs for enrolling customers into the loyalty program, retrieving
      customer loyalty details, and updating profile information such as birth
      date.
    name: Customer Enrollment & Profile
  - description: >-
      Admin APIs for managing customer point balances, transaction history,
      point earning rules, top customers leaderboard, and approving pending
      transactions.
    name: Points & Earn Rules
  - description: >-
      Admin APIs for redeeming customer points, managing redemption rules, and
      validating or updating discount codes generated through loyalty
      redemptions.
    name: Redemptions & Discount Codes
  - description: >-
      Admin APIs for retrieving storefront widget label translations consumed by
      the loyalty widget on the merchant's storefront.
    name: Storefront Widgets & Labels
paths:
  /api/external/check-discount:
    put:
      tags:
        - Redemptions & Discount Codes
      summary: Check discount code validity
      operationId: checkRewards
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckDiscountRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              example:
                createAt: '2025-01-15T10:30:00Z'
                customerId: 67890
                discountCode: LOYALTY15OFF
                discountType: PERCENTAGE
                discountValue: 15
                expiryDate: '2025-06-30T23:59:59Z'
                id: 12345
                minimumPurchaseAmount: 50
                pointsRedeemed: 100
                shopifyDiscountCodeId: gid://shopify/DiscountCode/123
                status: UNUSED
              schema:
                $ref: '#/components/schemas/CustomerReward'
          description: Discount code is valid and reward details returned
        '400':
          content:
            application/json:
              schema:
                example:
                  error: Discount code already used
                  status: USED
                  usedAt: '2025-01-20T14:30:00Z'
                type: string
          description: Discount code not valid
        '401':
          content:
            application/json:
              schema:
                example:
                  error: Invalid API key
                type: string
          description: Unauthorized - Invalid or missing X-API-Key
        '404':
          content:
            application/json:
              schema:
                example:
                  error: Discount code not found for the specified customer
                type: string
          description: Discount code not found for this customer
      security:
        - X-API-Key: []
components:
  schemas:
    CheckDiscountRequest:
      description: Request containing customer ID and discount code to validate
      example:
        customerId: 67890
        discountCode: LOYALTY15OFF
      properties:
        customerId:
          description: >
            Shopify customer ID (numeric). Identifies which customer is
            attempting to use the discount code.

            Used to verify the discount code belongs to this customer.

            Example: 67890
          example: 67890
          format: int64
          type: integer
        discountCode:
          description: |
            The discount code to validate. Case-insensitive.
            This is the code the customer enters at checkout.
            System will check if:
            - Code exists in loyalty system
            - Code belongs to this customer
            - Code status is UNUSED or ACTIVE
            - Code has not expired
            Examples: "LOYALTY15OFF", "VIP20", "WELCOME10"
          example: LOYALTY15OFF
          maxLength: 100
          type: string
      required:
        - customerId
        - discountCode
      type: object
    CustomerReward:
      properties:
        amount:
          format: double
          type: number
        createAt:
          format: date-time
          type: string
        customerId:
          format: int64
          type: integer
        description:
          type: string
        discountCode:
          type: string
        discountCodeId:
          type: string
        expireDate:
          format: date-time
          type: string
        id:
          format: int64
          type: integer
        lastExpiryReminderSentDate:
          format: date-time
          type: string
        orderId:
          format: int64
          type: integer
        orderName:
          type: string
        pointRedeemRuleId:
          format: int64
          type: integer
        pointTransactionId:
          format: int64
          type: integer
        productData:
          type: string
        rewardType:
          enum:
            - STORE_CREDIT
            - DISCOUNT_CODE
            - POINTS
          type: string
        shop:
          type: string
        status:
          enum:
            - USED
            - UNUSED
            - REFUNDED
            - EXPIRED
            - SUBSCRIPTION_ACTIVE
            - CANCELED
          type: string
        usageCount:
          format: int64
          type: integer
        usedAt:
          format: date-time
          type: string
        variantId:
          format: int64
          type: integer
      required:
        - createAt
        - customerId
        - discountCode
        - shop
        - status
      type: object

````