store Credit Account Creditmutation
mutation
2024-10latest
Requires write
access scope.
Creates a credit transaction that increases the store credit account balance by the given amount. This operation will create an account if one does not already exist.
Arguments
The input fields for a store credit account credit transaction.
The ID of the store credit account or the ID of the account owner.
Was this section helpful?
StoreCreditAccountCreditPayload returns
Anchor to StoreCreditAccountCreditPayload.storeCreditAccountTransactionstoreCredit Account Transaction The store credit account transaction that was created.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: storeCreditAccountCredit
Query Reference for MUTATION: storeCreditAccountCredit
"mutation storeCreditAccountCredit($creditInput: StoreCreditAccountCreditInput!, $id: ID!) {\n storeCreditAccountCredit(creditInput: $creditInput, id: $id) {\n storeCreditAccountTransaction {\n # StoreCreditAccountCreditTransaction fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: storeCreditAccountCredit
"{\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"29.99\",\n \"currencyCode\": \"AED\"\n },\n \"expiresAt\": \"2019-09-07T15:50:00Z\"\n },\n \"id\": \"gid://shopify/<objectName>/10079785100\"\n}"
Schema Reference for MUTATION: storeCreditAccountCredit
"input StoreCreditAccountCreditInput {\n creditAmount: MoneyInput!\n expiresAt: DateTime\n}\n\ninput MoneyInput {\n amount: Decimal!\n currencyCode: CurrencyCode!\n}\n"
Display Examples for MUTATION: storeCreditAccountCredit
[ { "example": { "type_name": "storecreditaccountcredit", "title": "Credit an amount to a store credit account by customer ID", "query_string": "mutation storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n}", "variables": { "id": "gid://shopify/Customer/544365967", "creditInput": { "creditAmount": { "amount": "49.99", "currencyCode": "USD" } } }, "response": { "data": { "storeCreditAccountCredit": { "storeCreditAccountTransaction": { "amount": { "amount": "49.99", "currencyCode": "USD" }, "account": { "id": "gid://shopify/StoreCreditAccount/316863792", "balance": { "amount": "61.1", "currencyCode": "USD" } } }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2024-07", "maximum_api_version": "unstable", "location": "/components/stored_value_instruments/store_credit/test/unit/models/graph_api/admin/mutations/store_credit_account_credit_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 storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) { storeCreditAccountCredit(id: $id, creditInput: $creditInput) { storeCreditAccountTransaction { amount { amount currencyCode } account { id balance { amount currencyCode } } } userErrors { message field } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Customer/544365967\",\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"49.99\",\n \"currencyCode\": \"USD\"\n }\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Customer/544365967\",\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"49.99\",\n \"currencyCode\": \"USD\"\n }\n }\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 storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Customer/544365967\",\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"49.99\",\n \"currencyCode\": \"USD\"\n }\n }\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 storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Customer/544365967\",\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"49.99\",\n \"currencyCode\": \"USD\"\n }\n }\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 storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/Customer/544365967\",\n \"creditInput\" => [\n \"creditAmount\" => [\n \"amount\" => \"49.99\",\n \"currencyCode\" => \"USD\",\n ],\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the store credit account or the ID of the account owner.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "id", "argValue": " \"gid://shopify/Customer/544365967\"", "typeKind": "MUTATION" }, { "arg": { "name": "creditInput", "description": "The input fields for a store credit account credit transaction.", "type": { "kind": "INPUT_OBJECT", "name": "StoreCreditAccountCreditInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "StoreCreditAccountCreditInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "creditInput", "argValue": " {\"creditAmount\":{\"amount\":\"49.99\",\"currencyCode\":\"USD\"}}", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "storecreditaccountcredit", "title": "Credit an expiring amount to a store credit account by account ID", "query_string": "mutation storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n}", "variables": { "id": "gid://shopify/StoreCreditAccount/316863792", "creditInput": { "expiresAt": "2028-10-26", "creditAmount": { "amount": "49.99", "currencyCode": "USD" } } }, "response": { "data": { "storeCreditAccountCredit": { "storeCreditAccountTransaction": { "amount": { "amount": "49.99", "currencyCode": "USD" }, "account": { "id": "gid://shopify/StoreCreditAccount/316863792", "balance": { "amount": "61.1", "currencyCode": "USD" } } }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2024-07", "maximum_api_version": "unstable", "location": "/components/stored_value_instruments/store_credit/test/unit/models/graph_api/admin/mutations/store_credit_account_credit_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 storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) { storeCreditAccountCredit(id: $id, creditInput: $creditInput) { storeCreditAccountTransaction { amount { amount currencyCode } account { id balance { amount currencyCode } } } userErrors { message field } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/StoreCreditAccount/316863792\",\n \"creditInput\": {\n \"expiresAt\": \"2028-10-26\",\n \"creditAmount\": {\n \"amount\": \"49.99\",\n \"currencyCode\": \"USD\"\n }\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/StoreCreditAccount/316863792\",\n \"creditInput\": {\n \"expiresAt\": \"2028-10-26\",\n \"creditAmount\": {\n \"amount\": \"49.99\",\n \"currencyCode\": \"USD\"\n }\n }\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 storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/StoreCreditAccount/316863792\",\n \"creditInput\": {\n \"expiresAt\": \"2028-10-26\",\n \"creditAmount\": {\n \"amount\": \"49.99\",\n \"currencyCode\": \"USD\"\n }\n }\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 storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/StoreCreditAccount/316863792\",\n \"creditInput\": {\n \"expiresAt\": \"2028-10-26\",\n \"creditAmount\": {\n \"amount\": \"49.99\",\n \"currencyCode\": \"USD\"\n }\n }\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 storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/StoreCreditAccount/316863792\",\n \"creditInput\" => [\n \"expiresAt\" => \"2028-10-26\",\n \"creditAmount\" => [\n \"amount\" => \"49.99\",\n \"currencyCode\" => \"USD\",\n ],\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the store credit account or the ID of the account owner.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "id", "argValue": " \"gid://shopify/StoreCreditAccount/316863792\"", "typeKind": "MUTATION" }, { "arg": { "name": "creditInput", "description": "The input fields for a store credit account credit transaction.", "type": { "kind": "INPUT_OBJECT", "name": "StoreCreditAccountCreditInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "StoreCreditAccountCreditInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "creditInput", "argValue": " {\"expiresAt\":\"2028-10-26\",\"creditAmount\":{\"amount\":\"49.99\",\"currencyCode\":\"USD\"}}", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "storecreditaccountcredit", "title": "Crediting a negative amount returns an error", "query_string": "mutation storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n}", "variables": { "id": "gid://shopify/Customer/1018520244", "creditInput": { "creditAmount": { "amount": "-100.00", "currencyCode": "USD" } } }, "response": { "data": { "storeCreditAccountCredit": { "storeCreditAccountTransaction": null, "userErrors": [ { "message": "A positive amount must be used to credit a store credit account", "field": [ "creditInput", "creditAmount", "amount" ] } ] } } }, "api_name": "admin", "minimum_api_version": "2024-07", "maximum_api_version": "unstable", "location": "/components/stored_value_instruments/store_credit/test/unit/models/graph_api/admin/mutations/store_credit_account_credit_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 storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) { storeCreditAccountCredit(id: $id, creditInput: $creditInput) { storeCreditAccountTransaction { amount { amount currencyCode } account { id balance { amount currencyCode } } } userErrors { message field } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Customer/1018520244\",\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"-100.00\",\n \"currencyCode\": \"USD\"\n }\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Customer/1018520244\",\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"-100.00\",\n \"currencyCode\": \"USD\"\n }\n }\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 storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Customer/1018520244\",\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"-100.00\",\n \"currencyCode\": \"USD\"\n }\n }\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 storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Customer/1018520244\",\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"-100.00\",\n \"currencyCode\": \"USD\"\n }\n }\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 storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/Customer/1018520244\",\n \"creditInput\" => [\n \"creditAmount\" => [\n \"amount\" => \"-100.00\",\n \"currencyCode\" => \"USD\",\n ],\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the store credit account or the ID of the account owner.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "id", "argValue": " \"gid://shopify/Customer/1018520244\"", "typeKind": "MUTATION" }, { "arg": { "name": "creditInput", "description": "The input fields for a store credit account credit transaction.", "type": { "kind": "INPUT_OBJECT", "name": "StoreCreditAccountCreditInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "StoreCreditAccountCreditInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "creditInput", "argValue": " {\"creditAmount\":{\"amount\":\"-100.00\",\"currencyCode\":\"USD\"}}", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "storecreditaccountcredit", "title": "Crediting an amount that exceeds the account limit returns an error", "description": "Store credit accounts have a limit which can differ depending on the currency of the account. Attempting to credit an amount that would exceed the account's limit will return an error.", "query_string": "mutation storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n}", "variables": { "id": "gid://shopify/Customer/1018520244", "creditInput": { "creditAmount": { "amount": "100000.00", "currencyCode": "USD" } } }, "response": { "data": { "storeCreditAccountCredit": { "storeCreditAccountTransaction": null, "userErrors": [ { "message": "The operation would cause the account's credit limit to be exceeded", "field": [ "creditInput", "creditAmount", "amount" ] } ] } } }, "api_name": "admin", "minimum_api_version": "2024-07", "maximum_api_version": "unstable", "location": "/components/stored_value_instruments/store_credit/test/unit/models/graph_api/admin/mutations/store_credit_account_credit_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 storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) { storeCreditAccountCredit(id: $id, creditInput: $creditInput) { storeCreditAccountTransaction { amount { amount currencyCode } account { id balance { amount currencyCode } } } userErrors { message field } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Customer/1018520244\",\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"100000.00\",\n \"currencyCode\": \"USD\"\n }\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Customer/1018520244\",\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"100000.00\",\n \"currencyCode\": \"USD\"\n }\n }\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 storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Customer/1018520244\",\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"100000.00\",\n \"currencyCode\": \"USD\"\n }\n }\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 storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Customer/1018520244\",\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"100000.00\",\n \"currencyCode\": \"USD\"\n }\n }\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 storeCreditAccountCredit($id: ID!, $creditInput: StoreCreditAccountCreditInput!) {\n storeCreditAccountCredit(id: $id, creditInput: $creditInput) {\n storeCreditAccountTransaction {\n amount {\n amount\n currencyCode\n }\n account {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/Customer/1018520244\",\n \"creditInput\" => [\n \"creditAmount\" => [\n \"amount\" => \"100000.00\",\n \"currencyCode\" => \"USD\",\n ],\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the store credit account or the ID of the account owner.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "id", "argValue": " \"gid://shopify/Customer/1018520244\"", "typeKind": "MUTATION" }, { "arg": { "name": "creditInput", "description": "The input fields for a store credit account credit transaction.", "type": { "kind": "INPUT_OBJECT", "name": "StoreCreditAccountCreditInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "StoreCreditAccountCreditInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "creditInput", "argValue": " {\"creditAmount\":{\"amount\":\"100000.00\",\"currencyCode\":\"USD\"}}", "typeKind": "MUTATION" } ] } ]