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

# Refund a Checkout

Refund all or part of a paid checkout. See [Refunds](https://docs.platnova.com/checkout/refunds.md) for rules, statuses and error codes.


## OpenAPI

````yaml POST /v1/checkout/{checkout_id}/refund
openapi: 3.1.0
info:
  title: API
  version: 1.0.0
  description: >-
    Platnova's Business API: collect payments with hosted checkout, issue
    virtual accounts and cards, send payouts, and receive webhooks.


    # Authentication


    Send your API key in the `X-API-Key` header on every request. Do not send it
    as `Authorization: Bearer`, and do not send a dashboard session token
    alongside it. The `api_key` query parameter is deprecated.


    # Base URLs


    - Live: https://api.platnova.com

    - Sandbox: https://sandbox.api.platnova.co


    # Errors


    Most responses are `{status: boolean, data, error: [], message}`; branch on
    the HTTP status and `data.code`. Validation failures are HTTP 422 `{status:
    "error", message: "Validation failed", errors: {field: [messages]}}`. A
    missing or invalid key is 401 `un-authorized access`. See
    https://docs.platnova.com/errors.
servers:
  - url: https://api.platnova.com
    description: Production server
  - url: https://sandbox.api.platnova.co
    description: Development server
security:
  - apiKeyAuth: []
tags:
  - name: Customer
    description: Create and manage customers
  - name: Virtual Account
    description: Create and manage virtual accounts
  - name: Card
    description: Create and manage cards
  - name: Wallet
    description: List and manage wallets
  - name: Payment
    description: Send and verify payments
  - name: Transaction
    description: List transactions and generate receipts
  - name: Checkout
    description: Create and retrieve checkout sessions
  - name: Payment Link
    description: Create and manage payment links
  - name: Invoice
    description: Create and manage invoices
  - name: Bank
    description: Bank lists and account verification for bank transfers
  - name: Bills
    description: Betting wallet top-ups
  - name: Refunds
paths:
  /v1/checkout/{checkout_id}/refund:
    post:
      tags:
        - Refunds
      summary: Refund a checkout
      operationId: createRefund
      parameters:
        - name: checkout_id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRefundRequest'
            example:
              amount: 2500
              reason: Customer returned item
              idempotency_key: order-1042-refund-1
      responses:
        '200':
          description: Refund created (or replayed for a repeated idempotency_key)
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                  data:
                    $ref: '#/components/schemas/Refund'
                  error:
                    type: array
                    items: {}
                  message:
                    type: string
        '202':
          description: Waiting for a teammate's approval
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                  data:
                    $ref: '#/components/schemas/Refund'
                  error:
                    type: array
                    items: {}
                  message:
                    type: string
        '400':
          description: Empty body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: checkout_not_found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: idempotency_key_reused or refund_in_progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            Validation failure or a refund refusal code (see docs:
            checkout_not_paid, amount_exceeds_refundable, insufficient_balance,
            ...)
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ValidationError422'
                  - $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/TooMany'
components:
  schemas:
    CreateRefundRequest:
      type: object
      required:
        - reason
        - idempotency_key
      properties:
        amount:
          type: number
          exclusiveMinimum: 0
          description: Omit for the full refundable amount.
        reason:
          type: string
          maxLength: 255
        idempotency_key:
          type: string
          maxLength: 128
        destination:
          $ref: '#/components/schemas/RefundDestination'
        approver:
          type: string
        lines:
          type: array
          maxItems: 100
          items:
            type: object
            properties:
              partner_line_reference:
                type: string
              amount:
                type: number
        partner_reference:
          type: string
          maxLength: 128
    Refund:
      type: object
      properties:
        id:
          type: string
        checkout_id:
          type: string
        payment_reference:
          type: string
        amount:
          type: number
        currency:
          type: string
        method:
          type: string
        status:
          type: string
          enum:
            - pending
            - processing
            - succeeded
            - failed
        reason:
          type: string
        failure_reason:
          type: string
        idempotency_key:
          type: string
        destination:
          oneOf:
            - $ref: '#/components/schemas/RefundDestination'
            - type: 'null'
        payout_reference:
          type: string
        provider_reference:
          type: string
        awaiting_approval:
          type: boolean
        lines:
          type: array
          items:
            type: object
        partner_reference:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        completed_at:
          type:
            - string
            - 'null'
          format: date-time
    Error:
      type: object
      properties:
        status:
          type: boolean
          example: false
        data:
          type: object
          description: Often empty. On coded errors holds `code` and details.
          properties:
            code:
              type: string
              example: request_in_progress
        error:
          type: array
          items:
            type: string
        message:
          type: string
          description: For people; don't parse.
    ValidationError422:
      type: object
      description: 'Validation failure (HTTP 422). Note: `status` is the string "error".'
      properties:
        status:
          type: string
          enum:
            - error
        message:
          type: string
          example: Validation failed
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
    RefundDestination:
      type: object
      properties:
        account_number:
          type: string
        bank_code:
          type: string
        account_name:
          type: string
          readOnly: true
  responses:
    Unauthorized:
      description: Missing or invalid API key (`un-authorized access`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooMany:
      description: Rate limited.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  headers:
    X-RateLimit-Limit:
      description: Requests allowed per minute on this route
      schema:
        type: integer
    X-RateLimit-Remaining:
      description: Requests left this minute
      schema:
        type: integer
    X-RateLimit-Reset:
      description: Unix time the window resets
      schema:
        type: integer
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key for authentication.

````

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