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

# Refund payment

> Create a refund for an existing payment



## OpenAPI

````yaml /openAPI/openapi-20240301.json post /payments/{payment_id}/refund
openapi: 3.1.0
info:
  title: zenskar
  version: 2.0.0
servers:
  - url: https://api.zenskar.com
security:
  - ApiTokenAuth: []
    OrganisationAuth: []
paths:
  /payments/{payment_id}/refund:
    post:
      tags:
        - Payments
      summary: Refund payment
      description: Create a refund for an existing payment
      operationId: Refund-payment
      parameters:
        - name: payment_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Payment Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRefundRequestSchema'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateRefundRequestSchema:
      properties:
        connector:
          anyOf:
            - $ref: '#/components/schemas/app__payments__schema__Connector'
            - type: 'null'
          description: Connector
        refund_payment_part_amounts:
          anyOf:
            - items:
                $ref: '#/components/schemas/PaymentPart'
              type: array
            - type: 'null'
          title: Refund Payment Part Amounts
          description: Payment Parts
        refund_amount:
          type: integer
          title: Refund Amount
          description: Total Refund Amount
        refund_destination:
          $ref: '#/components/schemas/RefundDestination'
          description: ' '
        writeoff_invoices:
          type: boolean
          title: Writeoff Invoices
          description: ' '
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: ' '
        timestamp:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Timestamp
          description: ' '
      type: object
      required:
        - refund_destination
        - writeoff_invoices
      title: CreateRefundRequestSchema
      description: Create Refund Request Schema
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    app__payments__schema__Connector:
      properties:
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: Connector Name
        reference_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Reference Id
          description: External Connector customer Refrence id
      type: object
      title: Connector
    PaymentPart:
      properties:
        invoice_id:
          type: string
          format: uuid
          title: Invoice Id
          description: Invoice ID
        amount:
          type: integer
          title: Amount
          description: Amount
      type: object
      required:
        - invoice_id
        - amount
      title: PaymentPart
      description: Payment Part Object
    RefundDestination:
      type: string
      enum:
        - credits
        - original_payment_method
        - external
      title: RefundDestination
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiTokenAuth:
      type: apiKey
      in: header
      name: x-api-key
      x-default: <your-api-key>
    OrganisationAuth:
      type: apiKey
      in: header
      name: organisation
      x-default: <your-organisation-id>

````