subscription Billing Attempt Createmutation
mutation
2024-10latest
Requires write
access scope. Also: The user must have manage_orders_information permission.
Creates a new subscription billing attempt. For more information, refer to Create a subscription contract.
Arguments
The information to apply as a billing attempt.
The ID of the subscription contract.
Was this section helpful?
SubscriptionBillingAttemptCreatePayload returns
Anchor to SubscriptionBillingAttemptCreatePayload.subscriptionBillingAttemptsubscriptionBilling Attempt The subscription billing attempt.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: subscriptionBillingAttemptCreate
Query Reference for MUTATION: subscriptionBillingAttemptCreate
"mutation subscriptionBillingAttemptCreate($subscriptionBillingAttemptInput: SubscriptionBillingAttemptInput!, $subscriptionContractId: ID!) {\n subscriptionBillingAttemptCreate(subscriptionBillingAttemptInput: $subscriptionBillingAttemptInput, subscriptionContractId: $subscriptionContractId) {\n subscriptionBillingAttempt {\n # SubscriptionBillingAttempt fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: subscriptionBillingAttemptCreate
"{\n \"subscriptionBillingAttemptInput\": {\n \"billingCycleSelector\": {\n \"date\": \"2019-09-07T15:50:00Z\",\n \"index\": 1\n },\n \"idempotencyKey\": \"<your-idempotencyKey>\",\n \"originTime\": \"2019-09-07T15:50:00Z\"\n },\n \"subscriptionContractId\": \"gid://shopify/<objectName>/10079785100\"\n}"
Schema Reference for MUTATION: subscriptionBillingAttemptCreate
"input SubscriptionBillingAttemptInput {\n billingCycleSelector: SubscriptionBillingCycleSelector\n idempotencyKey: String!\n originTime: DateTime\n}\n\ninput SubscriptionBillingCycleSelector {\n date: DateTime\n index: Int\n}\n"
Display Examples for MUTATION: subscriptionBillingAttemptCreate
[ { "example": { "type_name": "subscriptionbillingattemptcreate", "title": "Create a billing attempt on a specific billing cycle", "description": "Creates a billing attempt on the billing cycle with cycle index `1`.\n", "query_string": "mutation subscriptionBillingAttemptCreate($contractId: ID!, $index: Int!) {\n subscriptionBillingAttemptCreate(subscriptionContractId: $contractId, subscriptionBillingAttemptInput: {billingCycleSelector: {index: $index}, idempotencyKey: \"aaa-bbb-ccc\", originTime: \"2020-10-01T10:00:00Z\"}) {\n subscriptionBillingAttempt {\n id\n ready\n }\n userErrors {\n field\n message\n }\n }\n}", "variables": { "contractId": "gid://shopify/SubscriptionContract/593791907", "index": 1 }, "response": { "data": { "subscriptionBillingAttemptCreate": { "subscriptionBillingAttempt": { "id": "gid://shopify/SubscriptionBillingAttempt/528177097", "ready": false }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/sales/subscriptions/test/unit/graph_api/admin/mutations/subscription_billing_attempt_create_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation subscriptionBillingAttemptCreate($contractId: ID!, $index: Int!) { subscriptionBillingAttemptCreate(subscriptionContractId: $contractId, subscriptionBillingAttemptInput: {billingCycleSelector: {index: $index}, idempotencyKey: \\\"aaa-bbb-ccc\\\", originTime: \\\"2020-10-01T10:00:00Z\\\"}) { subscriptionBillingAttempt { id ready } userErrors { field message } } }\",\n \"variables\": {\n \"contractId\": \"gid://shopify/SubscriptionContract/593791907\",\n \"index\": 1\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation subscriptionBillingAttemptCreate($contractId: ID!, $index: Int!) {\n subscriptionBillingAttemptCreate(subscriptionContractId: $contractId, subscriptionBillingAttemptInput: {billingCycleSelector: {index: $index}, idempotencyKey: \"aaa-bbb-ccc\", originTime: \"2020-10-01T10:00:00Z\"}) {\n subscriptionBillingAttempt {\n id\n ready\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"contractId\": \"gid://shopify/SubscriptionContract/593791907\",\n \"index\": 1\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation subscriptionBillingAttemptCreate($contractId: ID!, $index: Int!) {\n subscriptionBillingAttemptCreate(subscriptionContractId: $contractId, subscriptionBillingAttemptInput: {billingCycleSelector: {index: $index}, idempotencyKey: \"aaa-bbb-ccc\", originTime: \"2020-10-01T10:00:00Z\"}) {\n subscriptionBillingAttempt {\n id\n ready\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"contractId\": \"gid://shopify/SubscriptionContract/593791907\",\n \"index\": 1\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation subscriptionBillingAttemptCreate($contractId: ID!, $index: Int!) {\n subscriptionBillingAttemptCreate(subscriptionContractId: $contractId, subscriptionBillingAttemptInput: {billingCycleSelector: {index: $index}, idempotencyKey: \"aaa-bbb-ccc\", originTime: \"2020-10-01T10:00:00Z\"}) {\n subscriptionBillingAttempt {\n id\n ready\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"contractId\": \"gid://shopify/SubscriptionContract/593791907\",\n \"index\": 1\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation subscriptionBillingAttemptCreate($contractId: ID!, $index: Int!) {\n subscriptionBillingAttemptCreate(subscriptionContractId: $contractId, subscriptionBillingAttemptInput: {billingCycleSelector: {index: $index}, idempotencyKey: \"aaa-bbb-ccc\", originTime: \"2020-10-01T10:00:00Z\"}) {\n subscriptionBillingAttempt {\n id\n ready\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"contractId\" => \"gid://shopify/SubscriptionContract/593791907\",\n \"index\" => 1,\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [] } ]