门店
列出所有门店
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
}
}