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

# Refund transaction V2

> Refunds the specified amount from the captured amount of a transaction. In case the amount is not specified, the full captured amount of the transaction is refunded.
The operation is idempotent and creates a new transaction with the refunded amount.



## OpenAPI

````yaml openapi/bonus-v1.json POST /v2/transactions/{id}/refund
openapi: 3.0.4
info:
  title: Accounting.Api
  version: v1
servers:
  - url: https://{host}/bonus
    description: Your Lobyco environment
    variables:
      host:
        default: your-environment.lobyco.net
        description: >-
          The API host for your Lobyco environment. Replace it with the host you
          were given — this placeholder does not resolve.
security:
  - Bearer: []
paths:
  /v2/transactions/{id}/refund:
    post:
      tags:
        - Service2Service
      summary: Refund transaction V2
      description: >-
        Refunds the specified amount from the captured amount of a transaction.
        In case the amount is not specified, the full captured amount of the
        transaction is refunded.

        The operation is idempotent and creates a new transaction with the
        refunded amount.
      parameters:
        - name: id
          in: path
          description: Unique payment transaction id.
          required: true
          schema:
            type: integer
            format: int64
      requestBody:
        description: Refund operation details.
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/Accounting.Api.Controllers.Service2Service.Models.RefundTransactionV2Request
          text/json:
            schema:
              $ref: >-
                #/components/schemas/Accounting.Api.Controllers.Service2Service.Models.RefundTransactionV2Request
          application/*+json:
            schema:
              $ref: >-
                #/components/schemas/Accounting.Api.Controllers.Service2Service.Models.RefundTransactionV2Request
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Accounting.Api.CQRS.Commands.RefundTransactionV2.Response
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/LoopFoundation.Commons.Contracts.WebServiceError
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/LoopFoundation.Commons.Contracts.WebServiceError
components:
  schemas:
    Accounting.Api.Controllers.Service2Service.Models.RefundTransactionV2Request:
      type: object
      properties:
        amount:
          type: number
          description: Amount of the payment which should be refunded.
          format: double
          nullable: true
        operationId:
          maxLength: 128
          type: string
          description: >-
            Unique identifier of the refund operation (should be the same only
            for retries of the same operation).
          nullable: true
        refundTransactionType:
          type: string
          nullable: true
        metadata:
          type: object
          additionalProperties:
            nullable: true
          nullable: true
      additionalProperties: false
    Accounting.Api.CQRS.Commands.RefundTransactionV2.Response:
      required:
        - remainingCapturedAmount
        - transactionId
      type: object
      properties:
        transactionId:
          type: integer
          description: Unique refund transaction id.
          format: int64
        remainingCapturedAmount:
          type: number
          description: Captured amount of the payment remaining after the refund operation.
          format: double
      additionalProperties: false
    LoopFoundation.Commons.Contracts.WebServiceError:
      required:
        - message
        - name
      type: object
      properties:
        name:
          minLength: 1
          type: string
        message:
          minLength: 1
          type: string
        details:
          nullable: true
      additionalProperties: false
  securitySchemes:
    Bearer:
      type: apiKey
      description: >-
        JWT Authorization header using the Bearer scheme. Example:
        "Authorization: Bearer {token}"
      name: Authorization
      in: header

````