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

# Refund

> When you want to refund values from a transaction, you need to send from your cash register to our API a request to do a refund value from the transaction.



## OpenAPI

````yaml /openapi.yml post /api/v2/refund/{transactionId}
openapi: 3.0.3
info:
  title: Gateway API
  version: v2
  contact:
    name: Support
    email: support@paybyrd.com
  license:
    name: Copyright © Paybyrd
  termsOfService: https://paybyrd.com/en/privacy
servers:
  - url: https://gateway.paybyrd.com
    description: Production
security:
  - authByApiKey: []
paths:
  /api/v2/refund/{transactionId}:
    post:
      tags:
        - Transactions
      summary: Refund
      description: >-
        When you want to refund values from a transaction, you need to send from
        your cash register to our API a request to do a refund value from the
        transaction.
      operationId: api-transactions-refund
      parameters:
        - name: transactionId
          in: path
          description: The transaction identification to be refunded
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RefundRequest'
            examples:
              Request example:
                $ref: '#/components/examples/RefundRequestExample'
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  $ref: '#/components/examples/RefundResponseExample'
              schema:
                $ref: '#/components/schemas/RefundResponse'
        '202':
          description: '202'
          content:
            application/json:
              examples:
                Result:
                  $ref: '#/components/examples/AcceptedResponseExample'
              schema:
                $ref: '#/components/schemas/AcceptedResponse'
        '400':
          description: '400'
          content:
            application/json:
              examples:
                Result:
                  $ref: '#/components/examples/PaymentAlreadyRefundedExample'
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: '404'
          content:
            application/json:
              examples:
                Result:
                  $ref: '#/components/examples/RefundTransactionNotFoundExample'
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      deprecated: false
components:
  schemas:
    RefundRequest:
      type: object
      required:
        - amount
        - isoAmount
      properties:
        isoAmount:
          type: integer
          description: The amount in ISO format, with the following pattern "2500"
          format: int64
        amount:
          type: string
          description: >-
            Please use the 'isoAmount' field. This is essential due to our
            multi-currency support.
          deprecated: true
    RefundResponse:
      type: object
      properties:
        amount:
          type: string
          description: The value that has been refunded.
          example: '1.00'
        isoAmount:
          type: integer
          description: The value that has been refunded.
          example: 100
          format: int64
        code:
          $ref: '#/components/schemas/PaybyrdCode'
        description:
          $ref: '#/components/schemas/PaybyrdDescription'
        sourceTransaction:
          $ref: '#/components/schemas/RefundSourceTransactionResponse'
        transactionId:
          type: string
          description: >-
            The unique identifier that represents the new transaction that is
            created by the refund.
          example: fa1db27d-7869-403f-b9cf-4306bf0162d8
    AcceptedResponse:
      type: object
      properties:
        code:
          type: string
          description: BYRD010
        description:
          type: string
          description: Request accepted
        links:
          $ref: '#/components/schemas/AcceptedLinkResponse'
    ErrorResponse:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/PaybyrdCode'
        description:
          $ref: '#/components/schemas/PaybyrdDescription'
    PaybyrdCode:
      type: string
      description: >-
        Represents the Paybyrd code of the web request. To see more details
        check in [Return Codes](ref:appendix-return-codes) page.
      example: BYRD200
      enum:
        - BYRD010
        - BYRD200
        - BYRD201
        - BYRD203
        - BYRD205
        - BYRD206
        - BYRD207
        - BYRD208
        - BYRD230
        - BYRD231
        - BYRD240
        - BYRD290
        - BYRD291
        - BYRD292
        - BYRD294
        - BYRD299
        - BYRD401
        - BYRD403
        - BYRD900
        - BYRD901
        - BYRD999
    PaybyrdDescription:
      type: string
      example: Operation successfully completed
      description: >-
        Represents a textually the description of the Paybyrd code of the web
        request.  To see more details check in [Return
        Codes](ref:appendix-return-codes) page
      enum:
        - Request accepted
        - Operation successfully completed
        - Payment being processed. Waiting for shopper
        - >-
          An error occurred while processing the payment. Please query the
          transaction to confirm its status
        - Operation rejected
        - Operation blocked by velocity
        - Pending redirect
        - Payment canceled by the shopper
        - Payment already refunded
        - >-
          The refund amount exceeds the remaining balance of the original
          payment
        - Token is expired
        - >-
          An error occurred while pre processing the transaction. Please review
          your request and try again
        - >-
          An error occurred during while preparing transaction for acquiring.
          Please review your request and try again
        - >-
          No payment methods available for this operation. Please contact
          Paybyrd's support
        - >-
          Transaction could not be updated. Please review your request and try
          again
        - >-
          Operation could not be completed. Please review your request and try
          again
        - Resource access is forbidden
        - Resource access unauthorized
        - Invalid input
        - Resource not found
        - Operation failed
    RefundSourceTransactionResponse:
      type: object
      properties:
        amount:
          type: string
          description: The value of source transaction.
          example: '3.00'
        isoAmount:
          type: integer
          description: The value of source transaction.
          example: 300
          format: int64
        refundedAmount:
          type: string
          example: '1.00'
        isoRefundedAmount:
          type: integer
          example: 100
        remainingAmount:
          type: string
          example: '2.00'
        isoRemainingAmount:
          type: integer
          example: 200
        transactionId:
          type: string
          description: The refunded transaction identifier.
          format: guid
          example: c16ce479-319d-4e7b-a966-7735c34b2cc5
    AcceptedLinkResponse:
      type: object
      properties:
        href:
          type: string
          description: The partial url to get the current process.
        rel:
          type: string
          description: The related entity to the process.
        type:
          type: string
          description: The HTTP method which must be used in the partial url.
  examples:
    RefundRequestExample:
      value:
        isoAmount: 100
    RefundResponseExample:
      value:
        isoAmount: 100
        amount: '1.00'
        code: BYRD200
        description: Operation successfully completed
        sourceTransaction:
          amount: '3.00'
          isoAmount: 300
          refundedAmount: '1.00'
          isoRefundedAmount: 100
          remainingAmount: '2.00'
          isoRemainingAmount: 200
          transactionId: c16ce479-319d-4e7b-a966-7735c34b2cc5
        transactionId: fa1db27d-7869-403f-b9cf-4306bf0162d8
    AcceptedResponseExample:
      value:
        code: BYRD010
        description: Request accepted
        links:
          href: /api/v2/transactions?requestId=93ce3e62-82b9-4570-8248-45915e794fd0
          rel: transactions
          type: GET
    PaymentAlreadyRefundedExample:
      value:
        code: BYRD230
        description: Payment already refunded
    RefundTransactionNotFoundExample:
      value:
        code: BYRD901
        description: Transaction not found
  securitySchemes:
    authByApiKey:
      type: apiKey
      in: header
      name: x-api-key

````