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

# Refund

> Refunds the one-time payment's sale in full, to the same card or account. Only on the day of the sale, before 10:30 PM Mexico City time. The customer gets the full charge back; Compago may keep the fee it charged on the sale and deduct it from the business's pending settlement (see `refund.feeRetained`). Call `GET /one-time-payment/{id}/refund-quote` first to know what it will cost and whether it will be accepted.



## OpenAPI

````yaml POST /developer/v1/one-time-payment/{id}/refund
openapi: 3.1.0
info:
  title: Compago API
  version: 1.0.0
  description: >-
    Public and private API endpoints for Compago's payment infrastructure. This
    specification currently includes endpoints for one-time payments. More
    endpoints will be added as the platform evolves.
servers:
  - url: https://demo-api-harmony.compago.com/api
  - url: https://api-harmony.compago.com/api
security: []
tags:
  - name: OneTimePayment
    description: Endpoints for creating and processing one-time payment links
  - name: PaymentMethod
    description: >-
      Endpoints for saving cards, charging saved payment methods, holding and
      capturing funds, and processing refunds
  - name: PaymentIntent
    description: >-
      Endpoints for creating and managing card-present payment intents for POS
      terminal integrations
  - name: Payments
    description: Read the payments your organization has taken
  - name: Subscriptions
    description: Read and manage recurring billing agreements
  - name: PaymentLinks
    description: Create, edit and retire hosted checkout links
  - name: Products
    description: Manage the catalogue behind product-based payment links
  - name: Promotions
    description: Read the promotions your organization funds or benefits from
  - name: Salespeople
    description: Read the point-of-sale operators in your organization
  - name: Organization
    description: Read your organization profile and its members
  - name: SavedCards
    description: Read saved payment methods and their payments
  - name: Payouts
    description: >-
      Read the transfers Compago sent to your bank accounts and what each one
      paid
  - name: Events
    description: >-
      Read the webhook events of the last 30 days, to reconcile after your
      endpoint was down
  - name: ApiKeys
    description: Manage your organization's API keys with a key that holds `apiKey:write`.
paths:
  /developer/v1/one-time-payment/{id}/refund:
    post:
      tags:
        - OneTimePayment
      summary: Refund a one-time payment
      description: >-
        Refunds the one-time payment's sale in full, to the same card or
        account. Only on the day of the sale, before 10:30 PM Mexico City time.
        The customer gets the full charge back; Compago may keep the fee it
        charged on the sale and deduct it from the business's pending settlement
        (see `refund.feeRetained`). Call `GET
        /one-time-payment/{id}/refund-quote` first to know what it will cost and
        whether it will be accepted.
      operationId: refundOneTimePayment
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: The unique identifier of the one-time payment to refund
      responses:
        '200':
          description: Sale refunded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundOneTimePaymentResponse'
        '400':
          description: >-
            `REFUND_WINDOW_EXPIRED`: past 10:30 PM Mexico City time on the day
            of the sale (or more than 24 hours after it). `NOT_REFUNDABLE`: the
            one-time payment has no approved sale.
            `REFUND_INSTALLMENTS_COLLECTED`: installments were already collected
            on the sale.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundError'
        '401':
          description: Unauthorized – missing or invalid API key
        '404':
          description: >-
            `ONE_TIME_PAYMENT_NOT_FOUND`: no such one-time payment in your
            organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundError'
        '409':
          description: >-
            `REFUND_FEE_NOT_COVERED`: the business's pending settlement and
            refund allowance do not cover the fee Compago keeps; nothing was
            sent to the bank. `ALREADY_REFUNDED`: the sale was already refunded.
            `REFUND_DECLINED`: the bank did not accept the refund.
            `REFUND_THROUGH_INTEGRATION`: the charge was made by an integration
            that refunds its own charges; refund it there.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/RefundFeeNotCoveredError'
                  - $ref: '#/components/schemas/RefundError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    RefundOneTimePaymentResponse:
      type: object
      description: The one-time payment whose sale was refunded.
      properties:
        id:
          type: string
          format: uuid
          example: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
          description: The one-time payment.
        paymentId:
          type: string
          format: uuid
          example: 11111111-2222-3333-4444-555555555555
          description: The sale that was refunded.
        status:
          type: string
          enum:
            - REFUNDED
          description: The sale's status after the refund.
        refund:
          $ref: '#/components/schemas/RefundSummary'
      required:
        - id
        - paymentId
        - status
        - refund
    RefundError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Stable machine-readable code. Branch on this, not on `message`.
            message:
              type: string
              description: Human-readable description.
          required:
            - code
            - message
      required:
        - error
    RefundFeeNotCoveredError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - REFUND_FEE_NOT_COVERED
            message:
              type: string
              description: Human-readable description.
            required:
              type: number
              format: decimal
              example: 3.48
              description: The fee to keep on this sale, IVA included.
            missing:
              type: number
              format: decimal
              example: 2.28
              description: '`required - available`.'
          required:
            - code
            - message
            - required
            - missing
      required:
        - error
    RefundSummary:
      type: object
      description: What the refund returned to the customer and what it cost the business.
      properties:
        amount:
          type: number
          format: decimal
          example: 100
          description: >-
            What goes back to the customer: always the full charge, tip
            included.
        feeRetained:
          $ref: '#/components/schemas/RefundFeeRetained'
        chargedFrom:
          type:
            - string
            - 'null'
          enum:
            - PENDING_SETTLEMENT
            - REFUND_ALLOWANCE
            - null
          description: >-
            Where the kept fee came from. `PENDING_SETTLEMENT`: the business's
            other pending sales covered it. `REFUND_ALLOWANCE`: they did not,
            and the missing part was added to the business's outstanding
            balance, within its refund allowance. Null when no fee was kept.
        kind:
          type: string
          enum:
            - SAME_DAY
            - LATE
          example: SAME_DAY
          description: >-
            `SAME_DAY` for every refund made through an API key. `LATE` only for
            a refund made from the dashboard after the sale was deposited: the
            whole amount came out of the business's next settlements and
            `feeRetained` is null, because the fee was already charged on the
            sale.
      required:
        - amount
        - feeRetained
        - chargedFrom
        - kind
    RefundFeeRetained:
      type:
        - object
        - 'null'
      description: >-
        The fee Compago keeps on the refunded sale: its percentage fee, fixed
        fee and MSI plan fee, plus IVA. It is deducted from what the business
        has pending to settle; the customer still gets the full charge back.
        Null when Compago does not keep the fee for this business.
      properties:
        fee:
          type: number
          format: decimal
          example: 3
          description: The fee before IVA.
        iva:
          type: number
          format: decimal
          example: 0.48
          description: IVA on the fee.
        total:
          type: number
          format: decimal
          example: 3.48
          description: >-
            `fee + iva`: what the business's settlement shows as a deduction for
            this sale.
      required:
        - fee
        - iva
        - total
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

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