Anchor to subscriptionBillingCycleScheduleEditsubscription
subscriptionBillingCycleScheduleEdit
mutation
Requires access scope. Also: The user must have manage_orders_information permission.
Modify the schedule of a specific billing cycle.
Anchor to Arguments
Arguments
- Anchor to billingCycleInputbilling•
Cycle Input SubscriptionBilling requiredCycle Input! Input object for selecting and using billing cycles.
- Anchor to inputinput•
Data used to create or modify billing cycle schedule edit.
Was this section helpful?
Anchor to SubscriptionBillingCycleScheduleEditPayload returnsSubscriptionBillingCycleScheduleEditPayload returns
- Anchor to billingCyclebilling•
Cycle The updated billing cycle.
- Anchor to userErrorsuser•
Errors The list of errors that occurred from executing the mutation.
Was this section helpful?
- Change the billing date of a cycle
- Skip a cycle
- subscriptionBillingCycleScheduleEdit reference
Examples
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 mutation subscriptionBillingCycleScheduleEdit($contractId: ID!, $index: Int!, $date: DateTime!) {6 subscriptionBillingCycleScheduleEdit(billingCycleInput: {contractId: $contractId, selector: {index: $index}}, input: {billingDate: $date, reason: BUYER_INITIATED}) {7 billingCycle {8 cycleIndex9 billingAttemptExpectedDate10 }11 userErrors {12 field13 message14 }15 }16 }`,17 {18 variables: {19 "contractId": "gid://shopify/SubscriptionContract/398475269",20 "index": 1,21 "date": "2021-12-31T07:00:00-05:00"22 },23 },24);2526const data = await response.json();27
mutation subscriptionBillingCycleScheduleEdit($contractId: ID!, $index: Int!, $date: DateTime!) {
subscriptionBillingCycleScheduleEdit(billingCycleInput: {contractId: $contractId, selector: {index: $index}}, input: {billingDate: $date, reason: BUYER_INITIATED}) {
billingCycle {
cycleIndex
billingAttemptExpectedDate
}
userErrors {
field
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation subscriptionBillingCycleScheduleEdit($contractId: ID!, $index: Int!, $date: DateTime!) { subscriptionBillingCycleScheduleEdit(billingCycleInput: {contractId: $contractId, selector: {index: $index}}, input: {billingDate: $date, reason: BUYER_INITIATED}) { billingCycle { cycleIndex billingAttemptExpectedDate } userErrors { field message } } }",
"variables": {
"contractId": "gid://shopify/SubscriptionContract/398475269",
"index": 1,
"date": "2021-12-31T07:00:00-05:00"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation subscriptionBillingCycleScheduleEdit($contractId: ID!, $index: Int!, $date: DateTime!) {
subscriptionBillingCycleScheduleEdit(billingCycleInput: {contractId: $contractId, selector: {index: $index}}, input: {billingDate: $date, reason: BUYER_INITIATED}) {
billingCycle {
cycleIndex
billingAttemptExpectedDate
}
userErrors {
field
message
}
}
}`,
{
variables: {
"contractId": "gid://shopify/SubscriptionContract/398475269",
"index": 1,
"date": "2021-12-31T07:00:00-05:00"
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation subscriptionBillingCycleScheduleEdit($contractId: ID!, $index: Int!, $date: DateTime!) {
subscriptionBillingCycleScheduleEdit(billingCycleInput: {contractId: $contractId, selector: {index: $index}}, input: {billingDate: $date, reason: BUYER_INITIATED}) {
billingCycle {
cycleIndex
billingAttemptExpectedDate
}
userErrors {
field
message
}
}
}`,
"variables": {
"contractId": "gid://shopify/SubscriptionContract/398475269",
"index": 1,
"date": "2021-12-31T07:00:00-05:00"
},
},
});
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
mutation subscriptionBillingCycleScheduleEdit($contractId: ID!, $index: Int!, $date: DateTime!) {
subscriptionBillingCycleScheduleEdit(billingCycleInput: {contractId: $contractId, selector: {index: $index}}, input: {billingDate: $date, reason: BUYER_INITIATED}) {
billingCycle {
cycleIndex
billingAttemptExpectedDate
}
userErrors {
field
message
}
}
}
QUERY
variables = {
"contractId": "gid://shopify/SubscriptionContract/398475269",
"index": 1,
"date": "2021-12-31T07:00:00-05:00"
}
response = client.query(query: query, variables: variables)
Input variables
JSON1{2 "contractId": "gid://shopify/SubscriptionContract/398475269",3 "index": 1,4 "date": "2021-12-31T07:00:00-05:00"5}
Response
JSON1{2 "subscriptionBillingCycleScheduleEdit": {3 "billingCycle": {4 "cycleIndex": 1,5 "billingAttemptExpectedDate": "2021-12-31T12:00:00Z"6 },7 "userErrors": []8 }9}