{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/super-payments/main/json-schema/super-payments-get-refund-transaction-output-schema.json",
  "title": "GetRefundTransactionOutput",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/super-payments-refunds-api-openapi.yml#/components/schemas/GetRefundTransactionOutput",
  "type": "object",
  "properties": {
    "transactionId": {
      "description": "Unique identifier for the payment transaction",
      "type": "string"
    },
    "transactionReference": {
      "description": "Reference code for the transaction",
      "type": "string"
    },
    "transactionStatus": {
      "description": "Current status of the refund transaction",
      "allOf": [
        {
          "$ref": "#/$defs/RefundOutputStatus"
        }
      ]
    },
    "brandId": {
      "description": "Brand identifier associated with the transaction",
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "payments": {
      "description": "List of refund payments",
      "type": "array",
      "items": {
        "$ref": "#/$defs/RefundPayment"
      }
    },
    "paymentMethodId": {
      "description": "Payment method identifier associated with the refund, if applicable",
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "transactionId",
    "transactionReference",
    "transactionStatus",
    "brandId",
    "payments"
  ],
  "$defs": {
    "BuyNowPayLaterRefundFundingDetails": {
      "type": "object",
      "properties": {
        "type": {
          "description": "Type identifier for Buy Now, Pay Later refund funding details. Used when refunds are processed through a BNPL provider like Klarna or Afterpay, typically reducing or canceling the customer's outstanding balance.",
          "allOf": [
            {
              "$ref": "#/$defs/BuyNowPayLaterRefundType"
            }
          ]
        },
        "institutionName": {
          "description": "Display name of the financial institution used for the buy now, pay later refund provider",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "type",
        "institutionName"
      ]
    },
    "BuyNowPayLaterRefundType": {
      "description": "Type identifier for Buy Now, Pay Later refund funding details. Used when refunds are processed through a BNPL provider like Klarna or Afterpay, typically reducing or canceling the customer's outstanding balance.",
      "type": "string",
      "const": "BUY_NOW_PAY_LATER"
    },
    "CardRefundFundingDetails": {
      "type": "object",
      "properties": {
        "type": {
          "description": "Type identifier for card refund funding details. Used when refunds are processed back to the original payment card or to a different card specified by the customer.",
          "allOf": [
            {
              "$ref": "#/$defs/CardRefundType"
            }
          ]
        },
        "brand": {
          "description": "Card brand (e.g., Visa, MasterCard, etc.)",
          "type": [
            "string",
            "null"
          ]
        },
        "last4": {
          "description": "Last 4 digits of the card number",
          "type": [
            "string",
            "null"
          ]
        },
        "reference": {
          "description": "[DEPRECATED] A reference identifier for this refund, if applicable. Use the top-level reference field instead. Nullable.",
          "type": [
            "string",
            "null"
          ],
          "deprecated": true
        },
        "referenceStatus": {
          "description": "[DEPRECATED] The status of the reference for this refund, if applicable. Use the top-level referenceStatus field instead. Nullable.",
          "type": [
            "string",
            "null"
          ],
          "deprecated": true
        },
        "referenceType": {
          "description": "[DEPRECATED] The type of reference for this refund, if applicable. Use the top-level referenceType field instead. Nullable.",
          "type": [
            "string",
            "null"
          ],
          "deprecated": true
        }
      },
      "required": [
        "type",
        "brand",
        "last4"
      ]
    },
    "CardRefundType": {
      "description": "Type identifier for card refund funding details. Used when refunds are processed back to the original payment card or to a different card specified by the customer.",
      "type": "string",
      "const": "CARD"
    },
    "CashRewardRefundFundingDetails": {
      "type": "object",
      "properties": {
        "type": {
          "description": "Type identifier for cash reward refund funding details. Used when refunds are credited back to the customer's Super Payments cash reward balance instead of their original payment method.",
          "allOf": [
            {
              "$ref": "#/$defs/CashRewardRefundType"
            }
          ]
        },
        "institutionName": {
          "description": "Display name of the financial institution used for the cash reward refund provider",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "type",
        "institutionName"
      ]
    },
    "CashRewardRefundType": {
      "description": "Type identifier for cash reward refund funding details. Used when refunds are credited back to the customer's Super Payments cash reward balance instead of their original payment method.",
      "type": "string",
      "const": "CASH_REWARD"
    },
    "OpenBankingRefundFundingDetails": {
      "type": "object",
      "properties": {
        "type": {
          "description": "Type identifier for open banking refund funding details. Used when refunds are processed directly to a customer's bank account using Open Banking payment rails.",
          "allOf": [
            {
              "$ref": "#/$defs/OpenBankingRefundType"
            }
          ]
        },
        "institutionName": {
          "description": "Display name of the financial institution used for the open banking refund provider",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "type",
        "institutionName"
      ]
    },
    "OpenBankingRefundType": {
      "description": "Type identifier for open banking refund funding details. Used when refunds are processed directly to a customer's bank account using Open Banking payment rails.",
      "type": "string",
      "const": "OPEN_BANKING"
    },
    "RefundOutputStatus": {
      "description": "Current status of the refund transaction",
      "type": "string",
      "enum": [
        "RefundAbandoned",
        "RefundFailed",
        "RefundPending",
        "RefundSuccess"
      ]
    },
    "RefundPayment": {
      "type": "object",
      "properties": {
        "amountInMinorUnits": {
          "description": "The amount of this refund payment in minor units (e.g., cents).",
          "type": "number"
        },
        "fundingInstitution": {
          "description": "The name of the funding institution for this refund payment, if applicable (e.g., bank name). Deprecated: use the institutionName field in the fundingDetails object instead.",
          "type": [
            "string",
            "null"
          ],
          "deprecated": true
        },
        "fundingCard": {
          "description": "Details of the card used for this refund payment, if applicable. Deprecated: use the card details in the fundingDetails object instead.",
          "allOf": [
            {
              "$ref": "#/$defs/RefundPaymentCard"
            }
          ],
          "deprecated": true
        },
        "reference": {
          "description": "A reference identifier for this refund payment, if applicable. Nullable.",
          "type": [
            "string",
            "null"
          ]
        },
        "referenceStatus": {
          "description": "The status of the reference for this refund payment, if applicable. Nullable.",
          "type": [
            "string",
            "null"
          ]
        },
        "referenceType": {
          "description": "The type of reference for this refund payment, if applicable (e.g., acquirer_reference_number). Nullable.",
          "type": [
            "string",
            "null"
          ]
        },
        "fundingDetails": {
          "description": "Detailed information about the funding method used for this specific refund payment.",
          "oneOf": [
            {
              "$ref": "#/$defs/CardRefundFundingDetails",
              "title": "Card Payment"
            },
            {
              "$ref": "#/$defs/OpenBankingRefundFundingDetails",
              "title": "Open Banking Payment"
            },
            {
              "$ref": "#/$defs/CashRewardRefundFundingDetails",
              "title": "Cash Reward Payment"
            },
            {
              "$ref": "#/$defs/BuyNowPayLaterRefundFundingDetails",
              "title": "Buy Now Pay Later Payment"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "amountInMinorUnits",
        "fundingInstitution",
        "fundingCard"
      ]
    },
    "RefundPaymentCard": {
      "type": "object",
      "properties": {
        "lastFourDigits": {
          "description": "The last four digits of the card used for the refund payment.",
          "type": "string"
        },
        "brand": {
          "description": "The brand of the card used for the refund payment (e.g., Visa, Mastercard).",
          "type": "string"
        }
      },
      "required": [
        "lastFourDigits",
        "brand"
      ]
    }
  }
}