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

# Close a Refund Request

> Use this endpoint to provide the closure decision and outcome for a
refund request.


**Notes:**

- This operation is typically triggered by BACEN's analysis completion.

- Closing a request sets its status to CLOSED and records the analysis
result.

- For accepted refunds, a refund transaction ID is recorded.

- Once closed, the request cannot be modified.



## OpenAPI

````yaml /en/openapi/v3-current/indirect-pix.yaml post /v1/dict/refund-requests/{refund_id}/close
openapi: 3.0.3
info:
  title: Plugin BR Pix Indirect - Complete API
  description: |
    Complete API for Brazilian Pix instant payment system including
    Pix key dictionary operations, QR code generation/decoding, transactions and
    transaction limits.
  version: 1.0.0
servers:
  - url: https://plugin-pix-indirect.api.lerian.net
security:
  - bearerAuth: []
paths:
  /v1/dict/refund-requests/{refund_id}/close:
    post:
      tags:
        - MED API
      summary: Close a Refund Request
      description: |-
        Use this endpoint to provide the closure decision and outcome for a
        refund request.


        **Notes:**

        - This operation is typically triggered by BACEN's analysis completion.

        - Closing a request sets its status to CLOSED and records the analysis
        result.

        - For accepted refunds, a refund transaction ID is recorded.

        - Once closed, the request cannot be modified.
      parameters:
        - $ref: '#/components/parameters/RefundId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CloseRefundInput'
            example:
              refundAnalysisResult: TOTALLY_ACCEPTED
              refundAnalysisDetails: Analysis confirms fraud. Refund approved.
      responses:
        '200':
          description: Refund request closed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundRequestObject'
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                ErrorPIX0001:
                  $ref: '#/components/examples/ErrorPIX0001'
                ErrorPIX0003:
                  $ref: '#/components/examples/ErrorPIX0003'
                ErrorPIX0004:
                  $ref: '#/components/examples/ErrorPIX0004'
                ErrorPIX0235:
                  $ref: '#/components/examples/ErrorPIX0235'
                ErrorPIX0237:
                  $ref: '#/components/examples/ErrorPIX0237'
                ErrorPIX0238:
                  $ref: '#/components/examples/ErrorPIX0238'
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                ErrorPIX0234:
                  $ref: '#/components/examples/ErrorPIX0234'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                ErrorPIX0236:
                  $ref: '#/components/examples/ErrorPIX0236'
                ErrorPIX0243:
                  $ref: '#/components/examples/ErrorPIX0243'
                ErrorPIX1068:
                  $ref: '#/components/examples/ErrorPIX1068'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                ErrorPIX0000:
                  $ref: '#/components/examples/ErrorPIX0000'
        '502':
          description: Bad Gateway
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                ErrorPIX1000:
                  $ref: '#/components/examples/ErrorPIX1000'
                ErrorPIX1007:
                  $ref: '#/components/examples/ErrorPIX1007'
                ErrorPIX1099:
                  $ref: '#/components/examples/ErrorPIX1099'
      deprecated: false
      security:
        - bearerAuth: []
components:
  parameters:
    RefundId:
      name: refund_id
      in: path
      description: Unique identifier of the refund request (UUID format).
      required: true
      example: 019c96a0-0c6b-7166-8510-b262039b4838
      schema:
        type: string
  schemas:
    CloseRefundInput:
      type: object
      required:
        - refundAnalysisResult
      properties:
        refundAnalysisResult:
          type: string
          description: Analysis result.
          enum:
            - TOTALLY_ACCEPTED
            - PARTIALLY_ACCEPTED
            - REJECTED
          example: TOTALLY_ACCEPTED
        refundAnalysisDetails:
          type: string
          description: Analysis comments.
          example: Analysis confirms fraud. Refund approved.
        refundRejectionReason:
          type: string
          description: Rejection reason (if rejected).
          enum:
            - NO_BALANCE
            - ACCOUNT_CLOSURE
            - INVALID_REQUEST
            - OTHER
        refundTransactionId:
          type: string
          description: Transaction ID for executing refund.
          example: E98765432202411241500REFUNDTRANS
    RefundRequestObject:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier.
          example: 019c96a0-0c6b-7166-8510-b262039b4838
        transactionId:
          type: string
          description: Original transaction ID.
          example: E12345678202411241430ABCDEFGHIJK
        amount:
          type: string
          description: Refund amount.
          example: '150.00'
        status:
          type: string
          description: Current status.
          enum:
            - OPEN
            - CLOSED
            - CANCELLED
          example: OPEN
        analysisResult:
          type: string
          description: Analysis result.
          example: TOTALLY_ACCEPTED
        createdAt:
          type: string
          format: date-time
          example: '2024-01-15T10:30:00Z'
        updatedAt:
          type: string
          format: date-time
          example: '2024-01-15T10:30:00Z'
    ErrorFormat:
      type: object
      description: The response message error.
      required:
        - code
        - title
        - message
      properties:
        code:
          type: string
          description: A unique, stable identifier for the error.
        title:
          type: string
          description: A brief summary of the issue.
        message:
          type: string
          description: Detailed guidance for resolving the error.
  examples:
    ErrorPIX0001:
      summary: Missing Headers in Request
      value:
        code: PIX-0001
        title: Missing Headers in Request
        message: >-
          Your request is missing one or more required header params. Please
          refer to the documentation to ensure all necessary header params are
          included in your request.
    ErrorPIX0003:
      summary: Missing Fields in Request
      value:
        code: PIX-0003
        title: Missing Fields in Request
        message: >-
          Your request is missing one or more required fields. Please refer to
          the documentation to ensure all necessary fields are included in your
          request.
    ErrorPIX0004:
      summary: Invalid Field Values in Request
      value:
        code: PIX-0004
        title: Invalid Field Values in Request
        message: >-
          Your request contains one or more fields with invalid values. Please
          refer to the documentation to verify that all fields have the correct
          values.
    ErrorPIX0235:
      summary: Missing Refund Transaction ID
      value:
        code: PIX-0235
        title: Missing Refund Transaction ID
        message: >-
          The refund transaction ID is required when the refund is accepted
          (TOTALLY_ACCEPTED or PARTIALLY_ACCEPTED).
    ErrorPIX0237:
      summary: Missing Rejection Reason
      value:
        code: PIX-0237
        title: Missing Rejection Reason
        message: The refundRejectionReason is required when analysisResult is REJECTED.
    ErrorPIX0238:
      summary: Missing Analysis Details
      value:
        code: PIX-0238
        title: Missing Analysis Details
        message: >-
          The analysisDetails field is required when analysisResult is REJECTED
          and refundRejectionReason is INVALID_REQUEST.
    ErrorPIX0234:
      summary: Refund Request Not Found
      value:
        code: PIX-0234
        title: Refund Request Not Found
        message: The specified refund request was not found.
    ErrorPIX0236:
      summary: Invalid Request Status
      value:
        code: PIX-0236
        title: Invalid Request Status
        message: >-
          The request cannot be closed because it is already in CLOSED or
          CANCELLED status.
    ErrorPIX0243:
      summary: Refund Request Already Closed
      value:
        code: PIX-0243
        title: Refund Request Already Closed
        message: The refund request is already closed.
    ErrorPIX1068:
      summary: Invalid Request Status
      value:
        code: PIX-1068
        title: Invalid Request Status
        message: >-
          The provider reports that the request is in an invalid state for this
          operation.
    ErrorPIX0000:
      summary: Internal Server Error
      value:
        code: PIX-0000
        title: Internal Server Error
        message: The server encountered an unexpected error. Please try again later.
    ErrorPIX1000:
      summary: Provider Connection Error
      value:
        code: PIX-1000
        title: Provider Connection Error
        message: Failed to connect to provider.
    ErrorPIX1007:
      summary: Provider Internal Error
      value:
        code: PIX-1007
        title: Provider Internal Error
        message: Provider returned an internal error.
    ErrorPIX1099:
      summary: Provider Unmapped Error
      value:
        code: PIX-1099
        title: Provider Unmapped Error
        message: Provider returned an unmapped error.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````