> ## 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.

# 取得商家

> 擷取含優惠與庫存資訊的商家目錄。

```javascript theme={null}
import { GraphQLClient, gql } from 'graphql-request';

const API_URL = 'https://transactional-graph.staging.fluzapp.com/api/v1/graphql';

const GET_MERCHANTS = gql`
  query getMerchants($name: String, $paginate: OffsetInput) {
    getMerchants(name: $name, paginate: $paginate) {
      merchantId
      name
      slug
      offers {
        offerId
        type
        offerRates {
          maxUserRewardValue
          denominations
        }
        stockInfo {
          ... on StockInfoVariableType {
            __typename
            description
            maxDenomination
            minDenomination
          }
          ... on StockInfoFixedType {
            __typename
            denomination
            availableStock
          }
        }
      }
    }
  }
`;

const client = new GraphQLClient(API_URL, {
  headers: {
    Authorization: `Bearer <USER_ACCESS_TOKEN>`,
    'Content-Type': 'application/json',
  },
});

const res = await client.request(GET_MERCHANTS, {
  name: null,
  paginate: { limit: 20, offset: 0 },
});

console.log(JSON.stringify(res, null, 2));
```

透過增加 `offset` 進行分頁，直到收到空陣列為止。

相關： [Rewards / Gift cards](/solutions/rewards).
