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

# Manually dispatch a refund for a failed or cancelled transaction

> Starts the refund workflow for the transaction's existing refund plan.

Works even when the transaction was created with `autoRefund: false`, so use this endpoint to trigger refunds that were intentionally left for manual handling.

Optionally pass a `refundDestination` to replace the destination stored on the plan. The override is validated against the PFI's refund capability before dispatch.

Plans in `Created` or `Eligible` status can be dispatched. Plans in `ManualRequired` status can also be dispatched if they were parked after a failed fiat payout; dispatching such a plan records consent to return the funds in crypto, converted from fiat at the current rate.



## OpenAPI

````yaml https://sandbox-api.borderless.xyz/v1/api-json post /v1/transactions/{id}/refund
openapi: 3.0.0
info:
  title: Borderless API
  description: The Borderless API documentation.
  version: '1.0'
  contact: {}
servers:
  - url: https://sandbox-api.borderless.xyz
security: []
tags: []
paths:
  /v1/transactions/{id}/refund:
    post:
      tags:
        - Refunds
      summary: Manually dispatch a refund for a failed or cancelled transaction
      description: >-
        Starts the refund workflow for the transaction's existing refund plan.


        Works even when the transaction was created with `autoRefund: false`, so
        use this endpoint to trigger refunds that were intentionally left for
        manual handling.


        Optionally pass a `refundDestination` to replace the destination stored
        on the plan. The override is validated against the PFI's refund
        capability before dispatch.


        Plans in `Created` or `Eligible` status can be dispatched. Plans in
        `ManualRequired` status can also be dispatched if they were parked after
        a failed fiat payout; dispatching such a plan records consent to return
        the funds in crypto, converted from fiat at the current rate.
      operationId: RefundsController_dispatchRefund
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ManualRefundDispatchDto'
      responses:
        '202':
          description: Refund workflow dispatched. Returns the current RefundResolution.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundResolutionEntity'
      security:
        - bearer: []
components:
  schemas:
    ManualRefundDispatchDto:
      type: object
      properties:
        refundDestination:
          description: >-
            Optional override for the refund destination. When provided,
            replaces the stored `RefundPlan.destination` before the workflow is
            dispatched. The override is re-validated against the PFI's refund
            capability using the same rules as on transaction creation.
          allOf:
            - $ref: '#/components/schemas/RefundDestinationDto'
    RefundResolutionEntity:
      type: object
      properties:
        supported:
          type: boolean
        requiresManualAction:
          type: boolean
        dispatchable:
          type: boolean
          description: >-
            Whether the refund plan can be dispatched now via POST
            /transactions/:id/refund.
        path:
          allOf:
            - $ref: '#/components/schemas/RefundPath'
        status:
          allOf:
            - $ref: '#/components/schemas/RefundPlanStatus'
        destinationSource:
          allOf:
            - $ref: '#/components/schemas/RefundDestinationSource'
        destination:
          nullable: true
          type: object
          allOf:
            - $ref: '#/components/schemas/RefundResolutionDestinationEntity'
        reason:
          nullable: true
          type: object
          allOf:
            - $ref: '#/components/schemas/RefundFailureReasonEntity'
        completedAt:
          format: date-time
          type: string
          nullable: true
        failedAt:
          format: date-time
          type: string
          nullable: true
        txHash:
          type: string
          nullable: true
          description: >-
            On-chain transaction hash of the settled refund. Null until the
            refund settles, and for refunds that settle off-chain.
      required:
        - supported
        - requiresManualAction
        - dispatchable
        - path
        - status
        - destinationSource
    RefundDestinationDto:
      type: object
      properties:
        type:
          description: >-
            How a refund should be handled if the transaction fails. `address`
            returns funds to a specific crypto address. `source` returns funds
            to the original on-chain sender (Yellowcard maps this to
            `settlementInfo.refundToSourceAddress`). `provider_balance` leaves
            funds in the client's account at the PFI.
          example: Address
          allOf:
            - $ref: '#/components/schemas/RefundDestinationType'
        address:
          type: string
          description: >-
            Required when `type` is `address`. The crypto address that should
            receive the refund.
          example: '0x1234567890abcdef1234567890abcdef12345678'
        autoRefund:
          type: boolean
          description: >-
            Whether Borderless should automatically trigger the refund on
            failure. Defaults to `true`. Setting `false` records the plan as
            eligible but keeps it `Created` until ops dispatches manually.
          example: true
          default: true
      required:
        - type
    RefundPath:
      type: string
      enum:
        - PfiAutoReversal
        - BalancePayout
        - ReturnToSender
        - PfiAutoReturn
        - ManualRequired
        - Unsupported
    RefundPlanStatus:
      type: string
      enum:
        - Created
        - Eligible
        - InProgress
        - Succeeded
        - Failed
        - Blocked
        - ManualRequired
        - Unsupported
        - Cancelled
    RefundDestinationSource:
      type: string
      enum:
        - None
        - PerTransaction
        - OrganizationDefault
        - OriginalSender
        - ProviderLocked
        - Manual
    RefundResolutionDestinationEntity:
      type: object
      properties:
        type:
          allOf:
            - $ref: '#/components/schemas/RefundDestinationType'
        address:
          type: string
          description: The crypto address that receives the refund.
        autoRefund:
          type: boolean
          description: Whether Borderless dispatches the refund automatically on failure.
        autoFiatReturn:
          type: boolean
          description: Whether Borderless dispatches a fiat return automatically.
      required:
        - type
    RefundFailureReasonEntity:
      type: object
      properties:
        message:
          type: string
          description: Human-readable failure summary.
        details:
          description: Provider-level error details for the failed refund attempt.
          type: array
          items:
            $ref: '#/components/schemas/RefundFailureDetailEntity'
    RefundDestinationType:
      type: string
      enum:
        - Address
        - Source
        - ProviderBalance
    RefundFailureDetailEntity:
      type: object
      properties:
        path:
          type: string
          description: The field the provider rejected, when it named one.
        pfiErrorMessage:
          type: string
          description: The error message as reported by the provider.
        externalStatus:
          type: string
          description: The provider-side status that made the refund terminal.
      required:
        - pfiErrorMessage
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````

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