subscriptionBillingCycle
Returns a subscription billing cycle found either by cycle index or date.
Arguments
- Anchor to billingCycleInputbilling•
Cycle Input SubscriptionBilling requiredCycle Input! Input object used to select and use billing cycles.
Anchor to Possible returnsPossible returns
- Anchor to SubscriptionBillingCycleSubscription•
Billing Cycle A subscription billing cycle.
- billing
Attempt •Expected Date Datenon-nullTime! The date on which the billing attempt is expected to be made.
- billing
Attempts • Subscriptionnon-nullBilling Attempt Connection! The list of billing attempts associated with the billing cycle.
- cycle
End •At Datenon-nullTime! The end date of the billing cycle.
- cycle
Index •Int!non-null The index of the billing cycle.
- cycle
Start •At Datenon-nullTime! The start date of the billing cycle.
- edited•Boolean!non-null
Whether this billing cycle was edited.
- edited
Contract •SubscriptionBilling Cycle Edited Contract The active edited contract for the billing cycle.
- skipped•Boolean!non-null
Whether this billing cycle was skipped.
- source
Contract •Subscriptionnon-nullContract! The subscription contract that the billing cycle belongs to.
- status•Subscriptionnon-null
Billing Cycle Billing Cycle Status! The status of the billing cycle.
- billing
- Get a billing cycle by cycle index
- Get a billing cycle by date
Examples
query subscriptionBillingCycle($contractId: ID!, $index: Int!) {
subscriptionBillingCycle(billingCycleInput: {contractId: $contractId, selector: {index: $index}}) {
billingAttemptExpectedDate
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query subscriptionBillingCycle($contractId: ID!, $index: Int!) { subscriptionBillingCycle(billingCycleInput: {contractId: $contractId, selector: {index: $index}}) { billingAttemptExpectedDate } }",
"variables": {
"contractId": "gid://shopify/SubscriptionContract/593791907",
"index": 1
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query subscriptionBillingCycle($contractId: ID!, $index: Int!) {
subscriptionBillingCycle(billingCycleInput: {contractId: $contractId, selector: {index: $index}}) {
billingAttemptExpectedDate
}
}`,
{
variables: {
"contractId": "gid://shopify/SubscriptionContract/593791907",
"index": 1
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `query subscriptionBillingCycle($contractId: ID!, $index: Int!) {
subscriptionBillingCycle(billingCycleInput: {contractId: $contractId, selector: {index: $index}}) {
billingAttemptExpectedDate
}
}`,
"variables": {
"contractId": "gid://shopify/SubscriptionContract/593791907",
"index": 1
},
},
});
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 subscriptionBillingCycle($contractId: ID!, $index: Int!) {
subscriptionBillingCycle(billingCycleInput: {contractId: $contractId, selector: {index: $index}}) {
billingAttemptExpectedDate
}
}
QUERY
variables = {
"contractId": "gid://shopify/SubscriptionContract/593791907",
"index": 1
}
response = client.query(query: query, variables: variables)