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

# Preview Item Refund

> Preview the amounts and side effects of a line-item refund before it is submitted.



## OpenAPI

````yaml post /billing/payment/{payment_id}/refund-preview
openapi: 3.1.0
info:
  title: Decoda API
  description: External API documentation for the Decoda Health platform.
  version: '1.0'
servers: []
security: []
paths:
  /billing/payment/{payment_id}/refund-preview:
    post:
      tags:
        - Payments
      summary: Preview Item Refund
      description: >-
        Preview the amounts and side effects of a line-item refund before it is
        submitted.
      operationId: preview_item_refund_billing_payment__payment_id__refund_preview_post
      parameters:
        - name: TENANT
          in: header
          required: true
          schema:
            type: string
            title: Tenant
          description: The tenant you are making this request on behalf of
        - name: API-KEY
          in: header
          required: true
          schema:
            type: string
            title: Api-Key
          description: Your api key
        - name: payment_id
          in: path
          required: true
          schema:
            type: string
            title: Payment Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RefundPreviewRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundPreview'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    RefundPreviewRequest:
      properties:
        refundDestination:
          $ref: '#/components/schemas/RefundDestination'
          default: ORIGINAL_METHOD
        items:
          items:
            $ref: '#/components/schemas/RefundItemSelection'
          type: array
          minItems: 1
          title: Items
      type: object
      required:
        - items
      title: RefundPreviewRequest
    RefundPreview:
      properties:
        paymentId:
          type: string
          title: Paymentid
        itemSubtotal:
          type: integer
          title: Itemsubtotal
        surchargeAmount:
          type: integer
          title: Surchargeamount
        refundTotal:
          type: integer
          title: Refundtotal
        items:
          items:
            $ref: '#/components/schemas/RefundPreviewItem'
          type: array
          title: Items
      type: object
      required:
        - paymentId
        - itemSubtotal
        - surchargeAmount
        - refundTotal
      title: RefundPreview
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    RefundDestination:
      type: string
      enum:
        - ORIGINAL_METHOD
        - PATIENT_CREDIT
      title: RefundDestination
    RefundItemSelection:
      properties:
        chargeItemId:
          type: string
          title: Chargeitemid
        pricingMode:
          $ref: '#/components/schemas/RefundItemPricingMode'
        quantity:
          anyOf:
            - type: integer
              exclusiveMinimum: 0
            - type: 'null'
          title: Quantity
        soldPackageId:
          anyOf:
            - type: string
            - type: 'null'
          title: Soldpackageid
        issuedGiftCardId:
          anyOf:
            - type: string
            - type: 'null'
          title: Issuedgiftcardid
        reversalActions:
          items:
            $ref: '#/components/schemas/RefundItemAction'
          type: array
          title: Reversalactions
      additionalProperties: false
      type: object
      required:
        - chargeItemId
        - pricingMode
      title: RefundItemSelection
      description: Staff intent for one item; the backend calculates all persisted money.
    RefundPreviewItem:
      properties:
        chargeItemId:
          type: string
          title: Chargeitemid
        pricingMode:
          $ref: '#/components/schemas/RefundItemPricingMode'
        quantity:
          anyOf:
            - type: number
            - type: 'null'
          title: Quantity
        grossAmount:
          type: integer
          title: Grossamount
        discountAmount:
          type: integer
          title: Discountamount
        amount:
          type: integer
          title: Amount
        taxAmount:
          type: integer
          title: Taxamount
        refundAmount:
          type: integer
          title: Refundamount
        soldPackageId:
          anyOf:
            - type: string
            - type: 'null'
          title: Soldpackageid
        issuedGiftCardId:
          anyOf:
            - type: string
            - type: 'null'
          title: Issuedgiftcardid
        reversalActions:
          items:
            $ref: '#/components/schemas/RefundItemAction'
          type: array
          title: Reversalactions
        availableReversalActions:
          items:
            $ref: '#/components/schemas/RefundItemAction'
          type: array
          title: Availablereversalactions
      type: object
      required:
        - chargeItemId
        - pricingMode
        - grossAmount
        - discountAmount
        - amount
        - taxAmount
        - refundAmount
      title: RefundPreviewItem
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    RefundItemPricingMode:
      type: string
      enum:
        - QUANTITY
        - PACKAGE_REMAINING_VALUE
      title: RefundItemPricingMode
      description: How the backend derives one RefundItem's authoritative value.
    RefundItemAction:
      type: string
      enum:
        - RESTORE_INVENTORY
        - RESTORE_MEMBER_DISCOUNT
        - RESTORE_SAVED_ITEM
        - CANCEL_PACKAGE
        - RESTORE_PACKAGE_SESSION
        - REVERSE_MEMBERSHIP
        - DISABLE_GIFT_CARD
        - REVOKE_LOYALTY
        - REVOKE_BANKED_VALUE
      title: RefundItemAction
      description: >-
        Operational side effects a refunded item may reverse, selected per
        RefundItem.


        Stored as an ``ARRAY(TypedEnum(RefundItemAction))`` on
        ``refund_item.reversal_actions``.

        An empty array means the item refunds money only, with no operational
        reversal.

        Each value is applied by the reconciler after the refund's money
        movement succeeds,

        and every application writes an idempotent marker keyed by
        ``refund_item_id``.

````