subscriptionBillingCycleBulkCharge
Requires access scope. Also: The user must have manage_orders_information permission.
Asynchronously queries and charges all subscription billing cycles whose billingAttemptExpectedDate values fall within a specified date range and meet additional filtering criteria. The results of this action can be retrieved using the subscriptionBillingCycleBulkResults query.
Arguments
- Anchor to billingAttemptExpectedDateRangebilling•
Attempt Expected Date Range Specifies the date range within which the
values of the billing cycles should fall.
- Anchor to filtersfilters•
Criteria to filter the billing cycles on which the action is executed.
- Anchor to inventoryPolicyinventory•
Policy SubscriptionBilling Default:PRODUCT_VARIANT_INVENTORY_POLICYAttempt Inventory Policy The behaviour to use when updating inventory.
Anchor to SubscriptionBillingCycleBulkChargePayload returnsSubscriptionBillingCycleBulkChargePayload returns
- •
The asynchronous job that performs the action on the targeted billing cycles.
- Anchor to userErrorsuser•
Errors The list of errors that occurred from executing the mutation.
- Create a job to charge all subscription billing cycles in time range
- subscriptionBillingCycleBulkCharge reference
Examples
mutation($startDate: DateTime!, $endDate: DateTime!) {
subscriptionBillingCycleBulkCharge(billingAttemptExpectedDateRange: {startDate: $startDate, endDate: $endDate}) {
job {
id
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation($startDate: DateTime!, $endDate: DateTime!) { subscriptionBillingCycleBulkCharge(billingAttemptExpectedDateRange: {startDate: $startDate, endDate: $endDate}) { job { id } } }",
"variables": {
"startDate": "2023-02-01T00:00:00-05:00",
"endDate": "2023-02-02T23:59:59-05:00"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation($startDate: DateTime!, $endDate: DateTime!) {
subscriptionBillingCycleBulkCharge(billingAttemptExpectedDateRange: {startDate: $startDate, endDate: $endDate}) {
job {
id
}
}
}`,
{
variables: {
"startDate": "2023-02-01T00:00:00-05:00",
"endDate": "2023-02-02T23:59:59-05:00"
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation($startDate: DateTime!, $endDate: DateTime!) {
subscriptionBillingCycleBulkCharge(billingAttemptExpectedDateRange: {startDate: $startDate, endDate: $endDate}) {
job {
id
}
}
}`,
"variables": {
"startDate": "2023-02-01T00:00:00-05:00",
"endDate": "2023-02-02T23:59:59-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($startDate: DateTime!, $endDate: DateTime!) {
subscriptionBillingCycleBulkCharge(billingAttemptExpectedDateRange: {startDate: $startDate, endDate: $endDate}) {
job {
id
}
}
}
QUERY
variables = {
"startDate": "2023-02-01T00:00:00-05:00",
"endDate": "2023-02-02T23:59:59-05:00"
}
response = client.query(query: query, variables: variables)