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

# Payin zurückerstatten

Mit diesem Endpunkt können Sie eine zuvor autorisierte Payin-Transaktion vollständig zurückerstatten.

**Voraussetzungen für die Rückerstattung**:

* Der Rückerstattungsbetrag muss dem ursprünglichen Payin-Betrag entsprechen.
* Die Rückerstattung muss an denselben Begünstigten und auf dasselbe Konto gesendet werden, die für den ursprünglichen Payin verwendet wurden.


## OpenAPI

````yaml openapi/de/localpayment.json PATCH /api/payin/{externalId}/refund
openapi: 3.1.0
info:
  version: '1.0'
  title: Localpayment
  contact:
    name: Support
    url: mailto:support@localpayment.com
servers:
  - url: https://api.stage.localpayment.com
    description: Stage
security:
  - token: []
paths:
  /api/payin/{externalId}/refund:
    patch:
      summary: Payin zurückerstatten
      operationId: refund-a-payin
      parameters:
        - name: Authorization
          in: header
          description: >-
            Bearer-Zugriffstoken zur Authentifizierung. Dieses Token erhalten
            Sie über die Endpunkte [Zugriffstoken
            abrufen](/de/reference/get-token) oder [Zugriffstoken
            aktualisieren](/de/reference/refresh-token).
          required: true
          schema:
            type: string
        - name: externalId
          in: path
          description: >-
            Auf Ihrer Seite generierte ID zur Rückverfolgbarkeit der
            Transaktion. Sie muss eindeutig sein und akzeptiert nur
            alphanumerische Zeichen und Bindestriche (zum Beispiel UUID4).
          required: true
          schema:
            type: string
            pattern: '[a-zA-Z0-9\- ]+'
            examples:
              - 53025bf4-4c87-4b4f-8fea-b47004440f37
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                externalId:
                  type: string
                  description: >-
                    Eine von Ihrem System generierte eindeutige Kennung zur
                    Nachverfolgung der Transaktion (alphanumerische Zeichen und
                    Bindestriche). Wir empfehlen UUID4, um die Eindeutigkeit
                    sicherzustellen. **Nur für Pix (Brasilien) und
                    Bargeld-Rückerstattungen erforderlich.**
                beneficiary:
                  type: object
                  description: >-
                    Objekt mit Angaben zum Begünstigten der Rückerstattung. 
                    **Nur für Pix (Brasilien) und Bargeld-Rückerstattungen
                    erforderlich.**
                  properties:
                    type:
                      type: string
                      enum:
                        - COMPANY
                        - INDIVIDUAL
                      description: Typ des Begünstigten (z. B. `INDIVIDUAL`, `COMPANY`).
                    name:
                      type: string
                      description: >-
                        Der Name des Begünstigten. Die zulässigen Zeichen hängen
                        vom Feld `type` ab: bei `individual` Buchstaben
                        (einschließlich Zeichen mit Akzent), Leerzeichen und
                        Punkte (`.`); bei `company` dieselben Zeichen plus
                        Ziffern, Unterstrich (`_`) und Bindestrich (`-`).
                      minLength: 2
                      maxLength: 255
                    lastname:
                      type: string
                      description: >-
                        Der Nachname des Begünstigten. Erforderlich, wenn `type`
                        den Wert `individual` hat, und ignoriert, wenn `type`
                        den Wert `company` hat. Die zulässigen Zeichen hängen
                        von `type` ab: bei `individual` Buchstaben
                        (einschließlich Zeichen mit Akzent), Leerzeichen und
                        Punkte (`.`); bei `company` dieselben Zeichen plus
                        Ziffern, Unterstrich (`_`) und Bindestrich (`-`).
                      minLength: 2
                      maxLength: 255
                    document:
                      type: object
                      properties:
                        type:
                          type: string
                          description: >-
                            Der
                            [Ausweisdokumenttyp](/de/reference/identity-document-types),
                            z. B. nationale Identitätsnummer,
                            Sozialversicherungsnummer oder Führerschein, je nach
                            Ausstellungsland.
                        id:
                          type: string
                          description: >-
                            Nummer des Ausweisdokuments (in der Regel eine
                            Zahl). Sie muss gemäß den Regeln des jeweiligen
                            Dokumenttyps gültig sein.
                    bank:
                      type: object
                      description: Bankdaten des Begünstigten.
                      properties:
                        name:
                          type: string
                          description: Bankname.
                        code:
                          type: string
                          description: 'Bankcode. '
                        account:
                          type: object
                          description: 'Bankkontodaten des Begünstigten. '
                          properties:
                            type:
                              type: string
                              description: 'Typ des Bankkontos (z. B. `C`, `S`). '
                            number:
                              type: string
                              description: Bankkontonummer.
                          required:
                            - type
                            - number
                        branch:
                          type: object
                          description: '**Nur Brasilien.** '
                          properties:
                            code:
                              type: string
                              description: Filialcode (1 bis 5 Ziffern).
                            name:
                              type: string
                              description: 'Filialname. '
                      required:
                        - name
                        - code
                        - account
                  required:
                    - type
                    - name
                    - bank
                comment:
                  type: string
                  description: >-
                    Kommentar oder Notiz mit zusätzlichen Informationen zur
                    Rückerstattungstransaktion.
              required:
                - externalId
                - beneficiary
              x-examples:
                Example 1:
                  comment: Refund API VA
                  beneficiary:
                    type: Type
                    name: Name
                    lastname: LastName
                    document:
                      type: DocumentType
                      id: DocumentId
                    bank:
                      name: BankName
                      code: Code
                      account:
                        type: BankAccountType
                        number: AccountNumber
            examples:
              Pix (Brazil) Refund:
                value:
                  comment: Pix refund
                  beneficiary:
                    type: INDIVIDUAL
                    name: John
                    lastname: Doe
                    document:
                      type: DocumentType
                      id: DocumentId
                    bank:
                      name: BankName
                      code: Code
                      account:
                        type: BankAccountType
                        number: AccountNumber
              902 - The payin was refunded:
                value:
                  externalId: e9407459-1ecc-4e18-800b-4bbae006afe2
                  internalId: 3e90d58c-8d3a-4c75-916e-a6d0add4f3b3
                  status:
                    code: '902'
                    description: REFUNDED
                    detail: The payin was refunded
              Cash refund:
                value:
                  comment: Cash refund
                  beneficiary:
                    type: INDIVIDUAL
                    name: John
                    lastname: Doe
                    document:
                      type: DocumentType
                      id: DocumentId
                    bank:
                      name: BankName
                      code: Code
                      account:
                        type: BankAccountType
                        number: AccountNumber
              Capture refund:
                value:
                  comment: Credit Card refund
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  externalId:
                    type: string
                    description: >-
                      Eine von Ihrem System generierte eindeutige Kennung zur
                      Nachverfolgung der Transaktion (alphanumerische Zeichen
                      und Bindestriche). Wir empfehlen UUID4, um die
                      Eindeutigkeit sicherzustellen.
                  internalId:
                    type: string
                    description: Localpayment-Transaktionskennung.
                  status:
                    type: object
                    title: status
                    description: Status des Vorgangs.
                    properties:
                      code:
                        type: string
                        description: >-
                          [Statuscode](/de/reference/transaction-status-error-codes).
                        examples:
                          - '902'
                      description:
                        type: string
                        description: >-
                          [Statusbeschreibung](/de/reference/transaction-status-error-codes).
                        examples:
                          - REFUNDED
                      detail:
                        type: string
                        description: Zusätzliche Statusinformationen.
                        examples:
                          - The payin was refunded
                x-examples:
                  Example 1:
                    externalId: '{{ExternalId}}'
                    internalId: '{{InternalId}}'
                    status:
                      code: '902'
                      description: REFUNDED
                      detail: The payin was refunded
              examples:
                902 - The payin was refunded.:
                  value:
                    externalId: e36ef929-c2d4-fcf0-b30c-99dc51798f4b
                    internalId: c09095fb-6a0e-47af-9f43-3d9452b0f290
                    status:
                      code: '902'
                      description: REFUNDED
                      detail: The payin was refunded
        '400':
          description: Ungültige Anfrage
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: object
                    description: Status des Vorgangs.
                    properties:
                      code:
                        type: string
                        description: >-
                          [Statuscode](/de/reference/transaction-status-error-codes).
                      description:
                        type: string
                        description: Statusbeschreibung.
                      detail:
                        type: string
                        description: Zusätzliche Statusinformationen.
                x-examples:
                  Example 1:
                    status:
                      code: '400'
                      description: ERROR
                      detail: Invalid operation
              examples:
                400 - Invalid operation:
                  value:
                    status:
                      code: '400'
                      description: ERROR
                      detail: Invalid operation
        '401':
          description: Nicht autorisiert.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Zusätzliche Informationen zur Antwort.
                  code:
                    type: string
                    description: Statuscode.
                  messages:
                    type: array
                    description: Liste der Meldungen.
                    items:
                      type: object
                      properties:
                        token_class:
                          type: string
                          description: Token-Klasse.
                        token_type:
                          type: string
                          description: Token-Typ.
                        message:
                          type: string
                          description: Meldung mit zusätzlichen Informationen.
                x-examples:
                  Example 1:
                    detail: Given token not valid for any token type
                    code: token_not_valid
                    messages:
                      - token_class: AccessToken
                        token_type: access
                        message: Token is invalid or expired
              examples:
                401 - Token is invalid or expired:
                  value:
                    detail: Given token not valid for any token type
                    code: token_not_valid
                    messages:
                      - token_class: AccessToken
                        token_type: access
                        message: Token is invalid or expired
        '404':
          description: Nicht gefunden
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: object
                    title: status
                    description: Status des Vorgangs.
                    properties:
                      code:
                        type: string
                        description: >-
                          [Statuscode](/de/reference/transaction-status-error-codes).
                      description:
                        type: string
                        description: Statusbeschreibung.
                      detail:
                        type: string
                        description: Zusätzliche Statusinformationen.
                x-examples:
                  Example 1:
                    status:
                      code: '404'
                      description: ERROR
                      detail: Payin not found
              examples:
                404 - Payin not found.:
                  value:
                    status:
                      code: '404'
                      description: ERROR
                      detail: Payin not found
      security:
        - token: []
      servers:
        - url: https://api.stage.localpayment.com
          description: Stage
components:
  securitySchemes:
    token:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.