> ## Documentation Index
> Fetch the complete documentation index at: https://voucherify-mk-benefit.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Examine Earnings

> ⚠️ **BETA endpoint**

This is a work-in-progress documentation of a BETA endpoint. The parameters, fields, request and response bodies, and other data may subject to change. If you want to share feedback or improvements, contact Voucherify support or your Technical Account Manager.

Performs a dry-run estimation of points and incentives a customer (or member) would earn for a given event, without actually triggering any earning rule processing or modifying balances.



## OpenAPI

````yaml /openapi/loyalties-v2.json post /v2/loyalties/examine/earning-rules
openapi: 3.1.0
info:
  title: Voucherify Loyalty v2 API
  version: 2.0.0
  description: >-
    Complete API documentation for Voucherify Loyalty v2 system. Requires
    LOYALTY_V2 feature flag.
servers:
  - url: https://api.voucherify.io
    description: Production
security:
  - bearerAuth: []
    X-App-Id: []
    X-App-Token: []
tags:
  - name: Card Definitions
    description: >-
      CRUD operations, lifecycle management, and activity history for card
      definitions. Card definitions describe the configuration for loyalty
      cards, including code generation, points expiration, earning/spending
      limits, pending points, refunds, and balance settings.
  - name: Programs
    description: >-
      Loyalty program CRUD, lifecycle management, program-scoped resource
      assignments (card definitions, earning rules, rewards, tier structures),
      member management (create, list, get, activate, deactivate, delete), card
      operations (points adjustment, pending points, expiring points,
      transactions), reward purchases, and activity history.
  - name: Earning Rules
    description: >-
      Manage earning rules that define how customers earn points or receive
      incentives based on triggers (events, segments, custom events). Includes
      CRUD, lifecycle, and activity history.
  - name: Tier Structures
    description: >-
      CRUD operations, lifecycle management, and activity history for tier
      structures. Includes nested tier definitions (create, list, update,
      delete) within tier structures. Tier structures define the tiering model
      for loyalty programs — how members qualify for and move between tiers.
  - name: Incentives
    description: >-
      Manage incentive definitions (fixed points, proportional points, material,
      digital). Includes CRUD, lifecycle transitions, and activity history.
  - name: Rewards
    description: >-
      CRUD, lifecycle operations, and activity history for reward definitions.
      Rewards can be material (product/SKU) or digital (discount coupons, gift
      vouchers).
  - name: Examine
    description: Examines the earning of loyalty points for a loyalty program member.
paths:
  /v2/loyalties/examine/earning-rules:
    post:
      tags:
        - Examine
      summary: Examine Earnings
      description: >-
        ⚠️ **BETA endpoint**


        This is a work-in-progress documentation of a BETA endpoint. The
        parameters, fields, request and response bodies, and other data may
        subject to change. If you want to share feedback or improvements,
        contact Voucherify support or your Technical Account Manager.


        Performs a dry-run estimation of points and incentives a customer (or
        member) would earn for a given event, without actually triggering any
        earning rule processing or modifying balances.
      operationId: examineLoyaltyEarnings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoyaltiesExamineEarningRulesRequestBody'
      responses:
        '200':
          description: Successful dry-run estimation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoyaltiesExamineEarningRulesResponseBody'
        '400':
          description: Invalid payload (e.g., mutual exclusivity violation).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Customer or member not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    LoyaltiesExamineEarningRulesRequestBody:
      type: object
      required:
        - event
        - customer_identification
      properties:
        event:
          type: string
          description: >-
            Trigger event. Currently supported: `customer.order.paid` or
            `order.paid`.
          example: customer.order.paid
        customer_identification:
          $ref: '#/components/schemas/VLExamineCustomerIdentification'
        customer_order_paid:
          $ref: '#/components/schemas/VLExamineCustomerOrderPaid'
    LoyaltiesExamineEarningRulesResponseBody:
      type: object
      properties:
        event:
          type: string
          description: The trigger event that was examined.
        memberships:
          type: array
          description: List of earning opportunities per active membership.
          items:
            $ref: '#/components/schemas/VLExamineMemberEarningOpportunity'
        object:
          type: string
          example: earnings_examine_result
    ErrorResponse:
      type: object
      description: Standard error response.
      properties:
        code:
          type: integer
          description: HTTP status code.
        key:
          type: string
          description: Machine-readable error key.
        message:
          type: string
          description: Human-readable error message.
        details:
          type: string
          description: Additional error details.
        request_id:
          type:
            - string
            - 'null'
          description: Request identifier for tracing.
        resource_id:
          type: string
          description: Related resource identifier (when applicable).
        resource_type:
          type: string
          description: Related resource type (when applicable).
      required:
        - code
        - key
        - message
    VLExamineCustomerIdentification:
      type: object
      description: Discriminated union identifying who is being evaluated.
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - customer_id
            - customer_source_id
            - member_id
          description: Determines which ID field is evaluated and required.
        customer_id:
          type: string
          description: Internal customer ID (cust_*). Evaluates all programs.
        customer_source_id:
          type: string
          description: External customer source ID. Evaluates all programs.
        member_id:
          type: string
          description: Internal member ID (mloy_*). Scopes to a single program.
    VLExamineCustomerOrderPaid:
      type: object
      description: >-
        Event-specific payload for customer.order.paid containing context for
        rule evaluation.
      properties:
        customer:
          type: object
          properties:
            metadata:
              type: object
              description: >-
                Customer metadata overlay (merged onto the resolved customer,
                not persisted).
        member:
          type: object
          description: >-
            Member metadata overlay. Only allowed when
            customer_identification.type is member_id.
          properties:
            metadata:
              type: object
        order:
          $ref: '#/components/schemas/VLExamineOrderParams'
    VLExamineMemberEarningOpportunity:
      type: object
      properties:
        member:
          $ref: '#/components/schemas/MemberResponse'
        program:
          $ref: '#/components/schemas/ProgramResponse'
        cards:
          type: array
          description: Per-card point estimations.
          items:
            $ref: '#/components/schemas/VLExamineCardEstimation'
        incentives:
          type: array
          description: Fulfillable incentives (digital, material).
          items:
            $ref: '#/components/schemas/LoyaltyIncentive'
        object:
          type: string
          example: member_earning_opportunity
    VLExamineOrderParams:
      type: object
      properties:
        amount:
          type: integer
          description: Post-discount order amount (cents).
        initial_amount:
          type: integer
          description: Pre-discount order amount (cents).
        discount_amount:
          type: integer
          description: Total discount amount (cents).
        metadata:
          type: object
          description: Order metadata for rule evaluation.
        items:
          type: array
          items:
            $ref: '#/components/schemas/VLExamineOrderItemParams'
    MemberResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique member identifier
        customer_id:
          type: string
          description: Associated customer identifier
        program_id:
          type: string
          description: Program the member belongs to
        status:
          type: string
          enum:
            - ACTIVE
            - INACTIVE
            - DELETED
          description: Current member status
        metadata:
          type: object
          description: Custom key-value metadata
          additionalProperties: true
        created_at:
          type: string
          format: date-time
          description: ISO 8601 creation timestamp
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
          description: ISO 8601 last update timestamp
        object:
          type: string
          const: member
    ProgramResponse:
      type: object
      description: Program DTO returned by toDTO()
      properties:
        id:
          type: string
          pattern: ^lprg_[a-f0-9]+$
          description: Unique program identifier
        name:
          type: string
          description: Program name
        status:
          $ref: '#/components/schemas/ProgramStatus'
        start_date:
          type:
            - string
            - 'null'
          format: date-time
          description: Program start date
        end_date:
          type:
            - string
            - 'null'
          format: date-time
          description: Program end date
        metadata:
          $ref: '#/components/schemas/Metadata'
        created_at:
          type: string
          format: date-time
          description: Creation timestamp (ISO 8601)
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Last update timestamp (ISO 8601)
        object:
          type: string
          const: program
    VLExamineCardEstimation:
      type: object
      properties:
        card:
          $ref: '#/components/schemas/VLCardReference'
        points_estimation:
          type: integer
          description: >-
            Total estimated points for this card (fixed + proportional +
            incentive points combined).
    LoyaltyIncentive:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        type:
          type: string
          enum:
            - DIGITAL
            - MATERIAL
            - POINTS
        status:
          type: string
        object:
          type: string
          example: incentive
    VLExamineOrderItemParams:
      type: object
      properties:
        id:
          type: string
        source_id:
          type: string
        product_id:
          type: string
        sku_id:
          type: string
        related_object:
          type: string
          enum:
            - product
            - sku
        amount:
          type: integer
        discount_amount:
          type: integer
        quantity:
          type: integer
        price:
          type: integer
        product:
          type: object
          properties:
            id:
              type: string
            source_id:
              type: string
            price:
              type: integer
        sku:
          type: object
          properties:
            id:
              type: string
            source_id:
              type: string
            price:
              type: integer
        metadata:
          type: object
    ProgramStatus:
      type: string
      enum:
        - DRAFT
        - ACTIVE
        - INACTIVE
        - DELETED
    Metadata:
      type: object
      description: Custom key-value metadata.
      additionalProperties: true
    VLCardReference:
      type: object
      properties:
        id:
          type: string
        card_definition_id:
          type: string
          description: Card definition identifier
        card_type:
          type: string
          description: Type of the card definition
        code:
          type: string
          description: Card code.
        object:
          type: string
          const: card
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    X-App-Id:
      type: apiKey
      name: X-App-Id
      in: header
    X-App-Token:
      type: apiKey
      name: X-App-Token
      in: header

````