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

# 取得最佳優惠

getOfferQuote

如果你的目標是拿到最高的現金回饋率，`getOfferQuote` [查詢](https://storage.googleapis.com/fluz-public-docs/api-reference.html#query-getOfferQuote) 會依照你提供的條件，幫你找出特定商家的最佳可用優惠。

## **回應：**

getOfferQuote 查詢的回應會回傳一個 Offer 物件，包含該商家最佳可用優惠的詳細資訊。

## **參數：**

**`input (GetOfferQuoteInput!)`**：\
用來指定尋找最佳優惠條件的輸入物件。此參數為必填，應包含商家的 slug 與其他相關細節。

**`GetOfferQuoteInput`** 欄位：

**`slug (String!)`**：\
商家的唯一 slug 識別碼。此欄位為必填。此 slug 用於指定要查詢哪個商家的優惠。你可以使用前面提到的 `getMerchants` 查詢來取得商家的 slug。

**`denomination (Float!)`**：\
欲查詢優惠所對應的購買金額。此欄位同樣為必填，該金額會影響可用優惠。

**`paymentMethod (PaymentMethodType):`**\
將用於此次購買的付款方式。預設為 `FLUZPAY`（你可用的 Fluz 餘額），但也可依優惠可用性指定其他付款方式，包括：

* `BANK_CARD`
* `BANK_ACCOUNT`
* `PAYPAL`
* `FLUZPAY`
* `APPLE_PAY`
* `GOOGLE_PAY`

## 範例用法：

以下示範如何撰寫一個 getOfferQuote 查詢：

```graphql theme={null}
query getOfferQuote($input: GetOfferQuoteInput!) {
  getOfferQuote(input: $input) {
    offeringMerchantId
    offerId
    type
    hasStockInfo
    offerRates {
      ...OfferRateFragment
    }
    denominationsType
    termsAndConditions
    stockInfo {
      ... on StockInfoVariableType {
        __typename
        description
        maxDenomination
        minDenomination
      }
      ... on StockInfoFixedType {
        __typename
        denomination
        availableStock
      }
    }
  }
}
```

### 回應詳細資訊

`Offer` 物件代表與該商家相關的優惠細節。

**`offeringMerchantId (UUID)`**：提供優惠的商家的唯一 ID。

**`offerId (UUID!)`**：優惠的唯一 ID。

**`type (OfferType)`**：指出優惠的類型。可能是標準禮品卡優惠或獨家費率優惠。\[範例：GIFT\_CARD\_OFFER、EXCLUSIVE\_RATE\_OFFER]。

**`hasStockInfo (Boolean)`**：指定此優惠是否包含庫存資訊。若為 true，stockInfo 欄位會回傳可用面額。

**`denominationsType (OfferDenominationType)`**：定義此優惠可用面額的類型。用來描述優惠的面額結構，例如固定或可變面額。

**`termsAndConditions (String)`**：此優惠的條款與細則（法律文本、限制、到期政策）。在使用者購買禮品卡前請顯示此 T\&C。

**`stockInfo ([StockInfoType]!)`**：StockInfo 是此優惠可用面額的清單。此欄位僅在 hasStockInfo 為 true 時可用，表示 Fluz 需確認庫存。請注意，回應時間會依供應商而異。stockInfo 會依 `VARIABLE` 或 `FIXED` 類型有條件地回傳資訊。欲查詢 stockInfo，你需要使用 `... on` 關鍵字的 inline fragment。若面額類型為 `VARIABLE` 則回傳 `StockInfoVariableType`，若為 `FIXED` 則回傳 `StockInfoFixedType`。

回應範例：

```json theme={null}
{
  "data": {
    "getOfferQuote": {
      "offeringMerchantId": "7b4280a6-dadc-4cf3-a99a-70d291e43c1c",
      "offerId": "7b4280a6-dadc-4cf3-a99a-70d291e43c1c",
      "type": "GIFT_CARD_OFFER",
      "hasStockInfo": true,
      "offerRates": [],
      "denominationsType": "VARIABLE",
      "termsAndConditions": "Card valid only for purchases on the merchant's U.S. website. Cannot be used to purchase other gift cards. Not redeemable for cash except where required by law.",
      "stockInfo": [
        {
          "__typename": "StockInfoVariableType",
          "description": "Available denominations range from $5 to $200",
          "maxDenomination": "200",
          "minDenomination": "5"
        }
      ]
    }
  }
}
```

更多細節請參考文章 [GraphQL API 的運作方式](/concepts/graphql)。

`OfferRate` 物件代表與優惠相關的特定回饋比率與條件。此物件包含使用者在使用優惠時可獲得的回饋詳細資訊，以及這些回饋適用的條件：

**`maxUserRewardValue (Float)`**：\
使用者可獲得的最高現金回饋金額。此欄位定義了特定優惠可賺取的回饋上限。

**`cashbackVoucherRewardValue (Float)`**：\
套用加碼後的現金回饋值。通常為消費前 \$10 部分享有 25% 的現金回饋加碼。

**`boostRewardValue (Float)`**：\
當優惠的現金回饋值被提高時，會顯示在此。這些優惠是在一段期間內提供給使用者的額外誘因。

**`displayBoostReward (Boolean)`**：\
指出是否應向使用者顯示加碼回饋。此欄位用於控制介面中加碼回饋的可見性。

**`denominations ([String])`**：\
符合優惠資格的面額陣列。這些面額代表可適用於優惠的特定金額（例如 "10"、"25"、"50"），用以定義可獲得回饋的金額。

**`allowedPaymentMethods ([String])`**：\
此優惠允許使用的付款方式陣列。此欄位指定使用者可用來享有優惠的付款方式（例如 "CREDIT\_CARD"、"PAYPAL"）。

> 🚧 現金回饋比率可能變動。
>
> 我們會盡力為客戶提供最佳可用優惠，這表示比率會定期調整。請在購買前務必確認當下比率。

<br />

<StickyContactSalesBanner />
