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

# Refund a captured payment

> Issues a full refund against a captured or completed payment. The refund is synchronous: PayGood calls Finix to reverse the capture transfer, persists the refund, and emits `payments.PaymentRefunded`. Omit `amount` to refund the full remaining balance.



## OpenAPI

````yaml /openapi.json post /payments/{paymentId}/refunds
openapi: 3.0.0
info:
  title: PayGood Merchant API
  description: Server-to-server integration surface for merchant API keys.
  version: '1448-03-01'
  contact: {}
servers:
  - url: https://api-sandbox.paygood.co
    description: Sandbox
  - url: https://api.paygood.co
    description: Production
security: []
paths:
  /payments/{paymentId}/refunds:
    post:
      tags:
        - payments
      summary: Refund a captured payment
      description: >-
        Issues a full refund against a captured or completed payment. The refund
        is synchronous: PayGood calls Finix to reverse the capture transfer,
        persists the refund, and emits `payments.PaymentRefunded`. Omit `amount`
        to refund the full remaining balance.
      operationId: RefundsController_create
      parameters:
        - name: paymentId
          required: true
          in: path
          description: Payment TypeID (`pmt_...`) to refund.
          schema:
            example: pmt_01hxy8m1nqk9g3x3y3p0azq2bg
            type: string
        - name: Idempotency-Key
          in: header
          description: >-
            Client-supplied unique key for safe retries of this mutating
            request. Scoped per merchant or resource as documented on each
            endpoint.
          required: true
          schema:
            type: string
            example: idem-01
      requestBody:
        required: true
        description: >-
          Optional refund amount, in the payment currency. Omit for a full
          refund; if provided, must equal the full remaining refundable balance
          during MVP.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRefundDto'
            examples:
              fullRefund:
                summary: Full refund (recommended MVP shape)
                value: {}
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundResponseDto'
      security:
        - bearer: []
components:
  schemas:
    CreateRefundDto:
      type: object
      properties:
        amount:
          type: integer
          exclusiveMinimum: true
          maximum: 9007199254740991
          minimum: 0
    RefundResponseDto:
      type: object
      properties:
        id:
          type: string
        paymentId:
          type: string
        amount:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        currency:
          description: Supported currency code (USD, CAD)
          type: string
          minLength: 3
          maxLength: 3
        processorReferenceId:
          type: string
          minLength: 1
        refundedAt:
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
        paymentStatus:
          type: string
          enum:
            - pending
            - authorized
            - captured
            - completed
            - voided
            - refunded
            - declined
            - returned
      required:
        - id
        - paymentId
        - amount
        - currency
        - processorReferenceId
        - refundedAt
        - paymentStatus
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: merchant_<prefix>_<secret>
      type: http
      description: Merchant API key bearer token.

````

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