メインコンテンツへスキップ

ストア

すべてのストアを一覧表示

query {
  stores {
    id
    name
    status
    slug
    supportEmail
    website
    prodEnabled
    createdAt
    updatedAt
  }
}

ネストされた商品を含む単一ストア

query($storeId: ID!) {
  store(id: $storeId) {
    id
    name
    status
    onetimeProducts {
      id
      name
      prices
      status
    }
    subscriptionProducts {
      id
      name
      billingPeriod
      prices
      status
    }
  }
}
変数:
{ "storeId": "STO_3bVzrkD0FJjFdZNLk8Ualx" }

単発商品

フィルタリングで商品を一覧表示

query($storeId: String!) {
  onetimeProducts(
    filter: {
      storeId: { eq: $storeId }
      status: { eq: "active" }
    }
    limit: 20
    offset: 0
  ) {
    id
    name
    description
    prices
    status
    version
    media
    successUrl
    metadata
    createdAt
    updatedAt
  }
  onetimeProductsCount(
    filter: { storeId: { eq: $storeId } }
  )
}
変数:
{ "storeId": "STO_3bVzrkD0FJjFdZNLk8Ualx" }

SDK の例

const result = await client.graphql.query<{
  onetimeProducts: Array<{
    id: string;
    name: string;
    prices: Record<string, { amount: string; taxCategory: string }>;
    status: string;
  }>;
  onetimeProductsCount: number;
}>({
  query: `query($storeId: String!) {
    onetimeProducts(filter: { storeId: { eq: $storeId }, status: { eq: "active" } }, limit: 20) {
      id name prices status
    }
    onetimeProductsCount(filter: { storeId: { eq: $storeId } })
  }`,
  variables: { storeId: "STO_3bVzrkD0FJjFdZNLk8Ualx" },
});

サブスクリプション商品

サブスクリプション商品の一覧表示

query($storeId: String!) {
  subscriptionProducts(filter: { storeId: { eq: $storeId } }) {
    id
    name
    description
    billingPeriod
    prices
    status
    version
    media
    metadata
    createdAt
    updatedAt
  }
  subscriptionProductsCount(filter: { storeId: { eq: $storeId } })
}

商品バージョン

バージョン履歴のクエリ

商品の更新ごとにイミュータブルバージョンが作成されます。バージョン履歴をクエリして過去のすべての設定を確認できます:
query($productId: String!) {
  onetimeProductVersions(filter: { productId: { eq: $productId } }) {
    id
    versionNumber
    name
    description
    prices
    media
    createdAt
  }
}

サブスクリプション商品バージョン

query($productId: String!) {
  subscriptionProductVersions(filter: { productId: { eq: $productId } }) {
    id
    versionNumber
    name
    billingPeriod
    prices
    metadata
    createdAt
  }
}
変数:
{ "productId": "PROD_4cWAslE1GKkGeaOMl9Vbmy" }

マーチャント

マーチャントの一覧表示

query {
  merchants {
    id
    email
    status
    createdAt
  }
  merchantsCount
}

単一マーチャント

query($id: ID!) {
  merchant(id: $id) {
    id
    email
    status
    createdAt
    updatedAt
  }
}