subscription Billing Cycles
Returns subscription billing cycles for a contract ID.
SubscriptionBillingCycleConnection arguments
- Anchor to afterafter•
The elements that come after the specified cursor.
- Anchor to beforebefore•
The elements that come before the specified cursor.
- Anchor to billingCyclesDateRangeSelectorbilling•
Cycles Date Range Selector Select subscription billing cycles within a date range.
- Anchor to billingCyclesIndexRangeSelectorbilling•
Cycles Index Range Selector Select subscription billing cycles within an index range.
- Anchor to contractIdcontract•
Id ID!required The ID of the subscription contract to retrieve billing cycles for.
- Anchor to firstfirst•
The first
n
elements from the paginated list.- Anchor to lastlast•
The last
n
elements from the paginated list.- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
- Anchor to sortKeysort•
Key SubscriptionBilling Cycles Sort KeysDefault:CYCLE_INDEX Sort the underlying list using a key. If your query is slow or returns an error, then try specifying a sort key that matches the field used in the search.
Anchor to Possible returnsPossible returns
- Anchor to edgesedges•[Subscription
Billing Cycle Edge!]!non-null The connection between the node and its parent. Each edge contains a minimum of the edge's cursor and the node.
- Anchor to nodesnodes•[Subscription
Billing Cycle!]!non-null A list of nodes that are contained in SubscriptionBillingCycleEdge. You can fetch data about an individual node, or you can follow the edges to fetch data about a collection of related nodes. At each node, you specify the fields that you want to retrieve.
- Anchor to pageInfopage•
Info PageInfo!non-null An object that’s used to retrieve cursor information about the current page.
Examples
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 query subscriptionBillingCycles($contractId: ID!) {6 subscriptionBillingCycles(first: 10, contractId: $contractId, billingCyclesDateRangeSelector: {startDate: "2022-12-15T00:00:00Z", endDate: "2023-02-15T00:00:00Z"}) {7 edges {8 node {9 billingAttemptExpectedDate10 }11 }12 }13 }`,14 {15 variables: {16 "contractId": "gid://shopify/SubscriptionContract/593791907"17 },18 },19);2021const data = await response.json();22
query subscriptionBillingCycles($contractId: ID!) {
subscriptionBillingCycles(first: 10, contractId: $contractId, billingCyclesDateRangeSelector: {startDate: "2022-12-15T00:00:00Z", endDate: "2023-02-15T00:00:00Z"}) {
edges {
node {
billingAttemptExpectedDate
}
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query subscriptionBillingCycles($contractId: ID!) { subscriptionBillingCycles(first: 10, contractId: $contractId, billingCyclesDateRangeSelector: {startDate: \"2022-12-15T00:00:00Z\", endDate: \"2023-02-15T00:00:00Z\"}) { edges { node { billingAttemptExpectedDate } } } }",
"variables": {
"contractId": "gid://shopify/SubscriptionContract/593791907"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query subscriptionBillingCycles($contractId: ID!) {
subscriptionBillingCycles(first: 10, contractId: $contractId, billingCyclesDateRangeSelector: {startDate: "2022-12-15T00:00:00Z", endDate: "2023-02-15T00:00:00Z"}) {
edges {
node {
billingAttemptExpectedDate
}
}
}
}`,
{
variables: {
"contractId": "gid://shopify/SubscriptionContract/593791907"
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `query subscriptionBillingCycles($contractId: ID!) {
subscriptionBillingCycles(first: 10, contractId: $contractId, billingCyclesDateRangeSelector: {startDate: "2022-12-15T00:00:00Z", endDate: "2023-02-15T00:00:00Z"}) {
edges {
node {
billingAttemptExpectedDate
}
}
}
}`,
"variables": {
"contractId": "gid://shopify/SubscriptionContract/593791907"
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
query subscriptionBillingCycles($contractId: ID!) {
subscriptionBillingCycles(first: 10, contractId: $contractId, billingCyclesDateRangeSelector: {startDate: "2022-12-15T00:00:00Z", endDate: "2023-02-15T00:00:00Z"}) {
edges {
node {
billingAttemptExpectedDate
}
}
}
}
QUERY
variables = {
"contractId": "gid://shopify/SubscriptionContract/593791907"
}
response = client.query(query: query, variables: variables)
Input variables
JSON1{2 "contractId": "gid://shopify/SubscriptionContract/593791907"3}
Response
JSON1{2 "subscriptionBillingCycles": {3 "edges": [4 {5 "node": {6 "billingAttemptExpectedDate": "2023-01-02T01:00:00Z"7 }8 },9 {10 "node": {11 "billingAttemptExpectedDate": "2023-02-02T01:00:00Z"12 }13 },14 {15 "node": {16 "billingAttemptExpectedDate": "2023-03-02T01:00:00Z"17 }18 }19 ]20 }21}