Managing Refunds

Refunds allow you to return purchased tickets and rail passes to the original payment method. The API provides a straightforward flow for checking what can be refunded, executing the refund, and tracking its status.

Refund Flow

The typical refund flow consists of three steps:

  1. Query refundable items — Use refundableItems to see what can be refunded and for how much
  2. Execute the refund — Use refundItems mutation to initiate the refund for selected items
  3. Track refund status — Use refunds to monitor the state of requested refunds

Getting Refundable Items

Before initiating a refund, you need to check which items on an order are eligible for refunding. The refundableItems query returns a list of items that can be refunded, along with the refund amount for each.

Wait for ticket issuance

Before requesting refundable items, ensure that tickets have been fully issued. Attempting to query refundable items before ticket issuance is complete may result in incomplete or inaccurate results. Check the order status and wait for all resources (tickets or pass codes) to be available before proceeding with refund operations.

Example: Query refundable items
graphql
query RefundableItems {
  refundableItems(orderId: "5a5607af-63b4-4789-a0f8-030edb26c356") {
    id
    description
    amount {
      amount
      currency
    }
    ... on RefundableOfferItem {
      offerParts {
        ... on AdmissionPart {
          flexibility
          serviceClass
        }
        ... on ReservationPart {
          flexibility
          accommodation {
            type
          }
        }
      }
    }
    ... on RefundablePassItem {
      passItem {
        code
        product
        class
      }
    }
  }
}
query RefundableItems {
  refundableItems(orderId: "5a5607af-63b4-4789-a0f8-030edb26c356") {
    id
    description
    amount {
      amount
      currency
    }
    ... on RefundableOfferItem {
      offerParts {
        ... on AdmissionPart {
          flexibility
          serviceClass
        }
        ... on ReservationPart {
          flexibility
          accommodation {
            type
          }
        }
      }
    }
    ... on RefundablePassItem {
      passItem {
        code
        product
        class
      }
    }
  }
}

Executing a Refund

Once you have identified the items to refund, use the refundItems mutation to execute the refund. You can refund one or more items in a single request.

Example: Execute a refund
graphql
mutation RefundItems {
  refundItems(
    orderId: "5a5607af-63b4-4789-a0f8-030edb26c356"
    refundableItemIds: ["2fc74101-1918-4f20-b73c-f5c230714cf7"]
  ) {
    id
    state
    createdAt
    items {
      id
      state
      description
      amount {
        amount
        currency
      }
    }
  }
}
mutation RefundItems {
  refundItems(
    orderId: "5a5607af-63b4-4789-a0f8-030edb26c356"
    refundableItemIds: ["2fc74101-1918-4f20-b73c-f5c230714cf7"]
  ) {
    id
    state
    createdAt
    items {
      id
      state
      description
      amount {
        amount
        currency
      }
    }
  }
}

The mutation returns a Refund object containing the state of the refund and the individual items being refunded. Each item has its own state which may differ from the overall refund state.

Tracking Refund Status

To check the status of previously requested refunds, use the refunds query. This returns all refunds associated with an order.

Example: Get refund status
graphql
query Refunds {
  refunds(orderId: "5a5607af-63b4-4789-a0f8-030edb26c356") {
    id
    state
    createdAt
    items {
      id
      state
      description
      amount {
        amount
        currency
      }
      ... on RefundOfferItem {
        offerParts {
          ... on AdmissionPart {
            flexibility
          }
        }
      }
      ... on RefundPassItem {
        passItem {
          product
        }
      }
    }
  }
}
query Refunds {
  refunds(orderId: "5a5607af-63b4-4789-a0f8-030edb26c356") {
    id
    state
    createdAt
    items {
      id
      state
      description
      amount {
        amount
        currency
      }
      ... on RefundOfferItem {
        offerParts {
          ... on AdmissionPart {
            flexibility
          }
        }
      }
      ... on RefundPassItem {
        passItem {
          product
        }
      }
    }
  }
}

Using the Refund Manager Embed

For a ready-made user interface, consider using the Refund Manager Embed. The embed provides a complete interface for managing refunds on an order, including refund history and the ability to select and process new refunds — all without writing any custom UI code.

html
<aa-refund-manager-modal
  open
  publicApiKey="my-api-key"
  order="5a5607af-63b4-4789-a0f8-030edb26c356"></aa-refund-manager-modal>
<aa-refund-manager-modal
  open
  publicApiKey="my-api-key"
  order="5a5607af-63b4-4789-a0f8-030edb26c356"></aa-refund-manager-modal>