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

# Pay for an order with points

> ⚠️ **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.

Pays for an order using points from the specified member loyalty card. The payment amount
and points to spend are calculated from the card definition's pay-with-points exchange
ratio formula, capped by the card balance and the optional `payment_limit`.

Requires an ACTIVE program, an ACTIVE member, and a card definition with pay-with-points
enabled and a configured exchange ratio formula.

Modes:
- `TRANSACTION` (default) — creates a PENDING order transaction (and an underlying card
  transaction) processed asynchronously. Returns HTTP 202.
- `DRY_RUN` — simulates the payment without creating any transaction. Returns HTTP 200
  with a SIMULATED transaction payload.




## OpenAPI

````yaml /openapi/loyalties-v2.json post /v2/loyalties/programs/{programId}/members/{memberId}/orders/payments
openapi: 3.1.0
info:
  title: Voucherify Loyalty v2 API
  version: 2.0.0
  description: >-
    Complete OpenAPI specification for the Voucherify Loyalty v2 API.

    All endpoints require the LOYALTY_V2 feature flag.


    Combined from per-domain specs: programs.yaml, members.yaml,
    program-operations.yaml, card-definitions.yaml, earning-rules.yaml,
    tier-structures.yaml, benefits.yaml, rewards.yaml, examine.yaml
servers:
  - url: '{protocol}://{host}'
    variables:
      protocol:
        default: https
        enum:
          - https
          - http
      host:
        default: api.voucherify.io
security:
  - bearerAuth: []
    X-App-Id: []
    X-App-Token: []
tags:
  - 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: 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: 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: Benefits
    description: >-
      Manage benefit 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: >-
      Evaluation endpoints that estimate earning opportunities and reward
      availability for a customer across their loyalty program memberships,
      without side effects.
paths:
  /v2/loyalties/programs/{programId}/members/{memberId}/orders/payments:
    post:
      tags:
        - Programs
      summary: Pay for an order with points
      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.


        Pays for an order using points from the specified member loyalty card.
        The payment amount

        and points to spend are calculated from the card definition's
        pay-with-points exchange

        ratio formula, capped by the card balance and the optional
        `payment_limit`.


        Requires an ACTIVE program, an ACTIVE member, and a card definition with
        pay-with-points

        enabled and a configured exchange ratio formula.


        Modes:

        - `TRANSACTION` (default) — creates a PENDING order transaction (and an
        underlying card
          transaction) processed asynchronously. Returns HTTP 202.
        - `DRY_RUN` — simulates the payment without creating any transaction.
        Returns HTTP 200
          with a SIMULATED transaction payload.
      operationId: createMemberOrderPayment
      parameters:
        - name: programId
          in: path
          required: true
          description: >
            Unique loyalty program identifier (format: `lprg_` followed by
            hexadecimal characters).
          schema:
            type: string
        - name: memberId
          in: path
          required: true
          description: Program member ID (format `lmbr_[a-f0-9]+`).
          schema:
            type: string
            pattern: ^lmbr_[a-f0-9]+$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderPaymentCreateRequest'
      responses:
        '200':
          description: >
            Dry run result (mode `DRY_RUN`). No transaction was created; the
            returned transaction has status SIMULATED and no `id`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderPaymentCreateResponse'
        '202':
          description: >
            Payment accepted (mode `TRANSACTION`). A PENDING order transaction
            was created and will be processed asynchronously.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderPaymentCreateResponse'
        '400':
          description: >-
            Validation error - request body or query parameters failed
            validation, or the operation is not allowed in the current resource
            state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Conflict - e.g. duplicate resource or invalid state transition.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    OrderPaymentCreateRequest:
      type: object
      description: |
        Request body for paying for an order with points.
      properties:
        card_id:
          type: string
          description: >
            Identifier of the member's loyalty card to spend points from (format
            `lcrd_...`).
        order:
          $ref: '#/components/schemas/OrderPaymentOrder'
        payment_limit:
          description: >
            Optional payment limit. When omitted, the default `CARD_BALANCE`
            limit is applied (spend up to the card balance).
          oneOf:
            - $ref: '#/components/schemas/OrderPaymentLimit'
            - type: 'null'
        mode:
          description: >
            Payment mode. `TRANSACTION` creates a PENDING order transaction
            processed asynchronously (HTTP 202). `DRY_RUN` only simulates the
            payment and returns the calculation result (HTTP 200); no
            transaction is created. Defaults to `TRANSACTION` when omitted or
            null.
          oneOf:
            - type: string
              enum:
                - TRANSACTION
                - DRY_RUN
            - type: 'null'
      required:
        - card_id
        - order
      additionalProperties: false
    OrderPaymentCreateResponse:
      type: object
      description: |
        Result of a pay-with-points request.
      properties:
        transaction:
          description: The created (or simulated) order transaction.
          oneOf:
            - $ref: '#/components/schemas/OrderPaymentTransaction'
            - type: 'null'
        status:
          type: string
          enum:
            - TRANSACTION_CREATED
            - DRY_RUN
          description: >
            Result status. `TRANSACTION_CREATED` for `TRANSACTION` mode,
            `DRY_RUN` for dry-run mode.
        message:
          type: string
          description: >
            Human-readable result message. `TRANSACTION` mode: "Pay with points
            transaction created". `DRY_RUN` mode: "Dry run mode. No transaction
            was created. This is only a simulation.".
    ErrorResponse:
      type: object
      description: Standard error response returned by all Loyalty v2 endpoints.
      properties:
        code:
          type: integer
          description: HTTP status code of the error.
        key:
          type: string
          description: Machine-readable error key.
        message:
          type: string
          description: Human-readable error message.
        details:
          type: string
          description: Additional details about the error.
        request_id:
          type: string
          description: Identifier of the request that produced the error.
    OrderPaymentOrder:
      type: object
      description: >
        Reference to the order being paid. At least one of `id` or `source_id`
        must be provided.
      properties:
        id:
          description: Voucherify order identifier.
          oneOf:
            - type: string
              pattern: ^ord_[a-f0-9]+$
            - type: 'null'
        source_id:
          description: External (source) order identifier.
          oneOf:
            - type: string
              minLength: 1
            - type: 'null'
      additionalProperties: false
    OrderPaymentLimit:
      type: object
      description: >
        Payment limit. Discriminated by `type`: `CARD_BALANCE` — spend up to the
        card balance (no additional properties required); `POINTS_LIMIT` — cap
        the number of points spent (requires `points_limit`); `AMOUNT_LIMIT` —
        cap the paid amount (requires `amount_limit`).
      properties:
        type:
          type: string
          enum:
            - CARD_BALANCE
            - POINTS_LIMIT
            - AMOUNT_LIMIT
          description: Payment limit type.
        points_limit:
          description: >-
            Maximum number of points to spend. Required when `type` is
            `POINTS_LIMIT`.
          oneOf:
            - $ref: '#/components/schemas/OrderPaymentLimitDefinition'
            - type: 'null'
        amount_limit:
          description: Maximum amount to pay. Required when `type` is `AMOUNT_LIMIT`.
          oneOf:
            - $ref: '#/components/schemas/OrderPaymentLimitDefinition'
            - type: 'null'
      required:
        - type
      additionalProperties: false
      oneOf:
        - properties:
            type:
              const: CARD_BALANCE
        - required:
            - points_limit
          properties:
            type:
              const: POINTS_LIMIT
            points_limit:
              $ref: '#/components/schemas/OrderPaymentLimitDefinition'
        - required:
            - amount_limit
          properties:
            type:
              const: AMOUNT_LIMIT
            amount_limit:
              $ref: '#/components/schemas/OrderPaymentLimitDefinition'
    OrderPaymentTransaction:
      type: object
      description: |
        An order transaction. Represents a pay-with-points payment.
      properties:
        id:
          type: string
          description: >
            Unique order transaction identifier (format `lotx_...`). Absent for
            DRY_RUN (SIMULATED) transactions, which are never persisted.
        program_id:
          type: string
          description: Identifier of the loyalty program (format `lprg_...`).
        member_id:
          type: string
          description: Identifier of the program member (format `lmbr_...`).
        card_id:
          type: string
          description: >-
            Identifier of the loyalty card the points were spent from (format
            `lcrd_...`).
        card_definition_id:
          type: string
          description: Identifier of the card definition (format `lcdef_...`).
        card_transaction_id:
          type:
            - string
            - 'null'
          description: >
            Identifier of the underlying card transaction (format `lctx_...`).
            `null` for DRY_RUN (SIMULATED) transactions.
        order_id:
          type: string
          description: Identifier of the paid order (format `ord_...`).
        status:
          type: string
          enum:
            - PENDING
            - PROCESSING
            - APPROVED
            - REJECTED
            - SIMULATED
          description: >
            Transaction status. `PENDING` — created, awaiting processing;
            `PROCESSING` — being processed; `APPROVED` — completed successfully;
            `REJECTED` — rejected (see `details.rejection`); `SIMULATED` —
            dry-run result, not persisted.
        type:
          type: string
          enum:
            - PAY_WITH_POINTS
          description: Transaction type.
        details:
          description: Transaction details for the `PAY_WITH_POINTS` type.
          oneOf:
            - $ref: '#/components/schemas/OrderPaymentTransactionDetails'
            - type: 'null'
        created_at:
          type: string
          format: date-time
          description: Timestamp when the transaction was created (ISO 8601).
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            Timestamp when the transaction was last updated (ISO 8601), or
            `null`.
        object:
          type: string
          const: order_transaction
          description: Object type marker. Always `order_transaction`.
    OrderPaymentLimitDefinition:
      type: object
      description: |
        Definition of a payment limit value.
      properties:
        max:
          type: integer
          minimum: 1
          description: Maximum value of the limit.
      required:
        - max
      additionalProperties: false
    OrderPaymentTransactionDetails:
      type: object
      description: |
        Details of a PAY_WITH_POINTS order transaction.
      properties:
        reason:
          type: string
          description: 'Human-readable reason: "Points spent on order payment".'
        rejection:
          description: Rejection details, present when the transaction was rejected.
          oneOf:
            - $ref: '#/components/schemas/OrderPaymentRejection'
            - type: 'null'
        metadata:
          type: object
          description: >
            Transaction metadata. For pay-with-points transactions this contains
            the flattened payment limits used for the calculation:
            `amount_limit` and/or `points_limit` (omitted when the default
            CARD_BALANCE limit was used). Empty object when not set.
          properties:
            amount_limit:
              type: integer
              description: Maximum amount limit applied to the payment (if any).
            points_limit:
              type: integer
              description: Maximum points limit applied to the payment (if any).
          additionalProperties: true
        payment:
          $ref: '#/components/schemas/OrderPaymentPaymentDetails'
    OrderPaymentRejection:
      type: object
      description: Rejection details.
      properties:
        reason:
          type: string
          description: Machine-readable rejection reason.
        details:
          type: string
          description: Additional human-readable details about the rejection.
    OrderPaymentPaymentDetails:
      type: object
      description: Payment calculation details.
      properties:
        id:
          type: string
          description: Payment identifier. Omitted when not set.
        amount:
          type: number
          description: Order amount paid with points.
        points_spent:
          type: number
          description: Number of points spent on the payment.
        exchange_ratio:
          type: number
          description: >
            Points-to-amount exchange ratio evaluated from the card definition's
            pay-with-points formula.
  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

````