payment Terms Createmutation
mutation
2024-10latest
Requires write
access scope. Also: The user must have access to orders or draft orders.
Create payment terms on an order. To create payment terms on a draft order, use a draft order mutation and include the request with the Draft
.
Arguments
The attributes used to create the payment terms.
Specifies the reference orderId to add the payment terms for.
Was this section helpful?
PaymentTermsCreatePayload returns
The created payment terms.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: paymentTermsCreate
Query Reference for MUTATION: paymentTermsCreate
"mutation paymentTermsCreate($paymentTermsAttributes: PaymentTermsCreateInput!, $referenceId: ID!) {\n paymentTermsCreate(paymentTermsAttributes: $paymentTermsAttributes, referenceId: $referenceId) {\n paymentTerms {\n # PaymentTerms fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: paymentTermsCreate
"{\n \"paymentTermsAttributes\": {\n \"paymentSchedules\": [\n {\n \"dueAt\": \"2019-09-07T15:50:00Z\",\n \"issuedAt\": \"2019-09-07T15:50:00Z\"\n }\n ],\n \"paymentTermsTemplateId\": \"gid://shopify/<objectName>/10079785100\"\n },\n \"referenceId\": \"gid://shopify/<objectName>/10079785100\"\n}"
Schema Reference for MUTATION: paymentTermsCreate
"input PaymentTermsCreateInput {\n paymentSchedules: [PaymentScheduleInput!]\n paymentTermsTemplateId: ID!\n}\n\ninput PaymentScheduleInput {\n dueAt: DateTime\n issuedAt: DateTime\n}\n"
Display Examples for MUTATION: paymentTermsCreate
[ { "example": { "type_name": "paymenttermscreate", "title": "Create due on receipt payment terms", "description": "Create payment terms that indicate payment is due when the invoice is sent by the merchant.", "query_string": "mutation PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) {\n paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) {\n paymentTerms {\n id\n }\n userErrors {\n field\n message\n }\n }\n}", "variables": { "referenceId": "gid://shopify/Order/922426937", "paymentTermsAttributes": { "paymentTermsTemplateId": "gid://shopify/PaymentTermsTemplate/1" } }, "response": { "data": { "paymentTermsCreate": { "paymentTerms": { "id": "gid://shopify/PaymentTerms/1054663035" }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/payments/payment_flexibility/test/unit/graph_api/admin/mutations/payment_terms_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 PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) { paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) { paymentTerms { id } userErrors { field message } } }\",\n \"variables\": {\n \"referenceId\": \"gid://shopify/Order/922426937\",\n \"paymentTermsAttributes\": {\n \"paymentTermsTemplateId\": \"gid://shopify/PaymentTermsTemplate/1\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) {\n paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) {\n paymentTerms {\n id\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"referenceId\": \"gid://shopify/Order/922426937\",\n \"paymentTermsAttributes\": {\n \"paymentTermsTemplateId\": \"gid://shopify/PaymentTermsTemplate/1\"\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 PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) {\n paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) {\n paymentTerms {\n id\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"referenceId\": \"gid://shopify/Order/922426937\",\n \"paymentTermsAttributes\": {\n \"paymentTermsTemplateId\": \"gid://shopify/PaymentTermsTemplate/1\"\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 PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) {\n paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) {\n paymentTerms {\n id\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"referenceId\": \"gid://shopify/Order/922426937\",\n \"paymentTermsAttributes\": {\n \"paymentTermsTemplateId\": \"gid://shopify/PaymentTermsTemplate/1\"\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 PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) {\n paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) {\n paymentTerms {\n id\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"referenceId\" => \"gid://shopify/Order/922426937\",\n \"paymentTermsAttributes\" => [\n \"paymentTermsTemplateId\" => \"gid://shopify/PaymentTermsTemplate/1\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "referenceId", "description": "Specifies the reference orderId to add the payment terms for.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "referenceId", "argValue": " \"gid://shopify/Order/922426937\"", "typeKind": "MUTATION" }, { "arg": { "name": "paymentTermsAttributes", "description": "The attributes used to create the payment terms.", "type": { "kind": "INPUT_OBJECT", "name": "PaymentTermsCreateInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "PaymentTermsCreateInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "paymentTermsAttributes", "argValue": " {\"paymentTermsTemplateId\":\"gid://shopify/PaymentTermsTemplate/1\"}", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "paymenttermscreate", "title": "Create fixed payment terms", "description": "Create payment terms that indicate payment is due on a fixed date.", "query_string": "mutation PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) {\n paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) {\n paymentTerms {\n id\n }\n userErrors {\n field\n message\n }\n }\n}", "variables": { "referenceId": "gid://shopify/Order/922426937", "paymentTermsAttributes": { "paymentTermsTemplateId": "gid://shopify/PaymentTermsTemplate/7", "paymentSchedules": [ { "dueAt": "2022-06-13T22:35:23.311Z" } ] } }, "response": { "data": { "paymentTermsCreate": { "paymentTerms": { "id": "gid://shopify/PaymentTerms/1054663034" }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/payments/payment_flexibility/test/unit/graph_api/admin/mutations/payment_terms_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 PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) { paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) { paymentTerms { id } userErrors { field message } } }\",\n \"variables\": {\n \"referenceId\": \"gid://shopify/Order/922426937\",\n \"paymentTermsAttributes\": {\n \"paymentTermsTemplateId\": \"gid://shopify/PaymentTermsTemplate/7\",\n \"paymentSchedules\": [\n {\n \"dueAt\": \"2022-06-13T22:35:23.311Z\"\n }\n ]\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) {\n paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) {\n paymentTerms {\n id\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"referenceId\": \"gid://shopify/Order/922426937\",\n \"paymentTermsAttributes\": {\n \"paymentTermsTemplateId\": \"gid://shopify/PaymentTermsTemplate/7\",\n \"paymentSchedules\": [\n {\n \"dueAt\": \"2022-06-13T22:35:23.311Z\"\n }\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 PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) {\n paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) {\n paymentTerms {\n id\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"referenceId\": \"gid://shopify/Order/922426937\",\n \"paymentTermsAttributes\": {\n \"paymentTermsTemplateId\": \"gid://shopify/PaymentTermsTemplate/7\",\n \"paymentSchedules\": [{\"dueAt\"=>\"2022-06-13T22:35:23.311Z\"}]\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 PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) {\n paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) {\n paymentTerms {\n id\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"referenceId\": \"gid://shopify/Order/922426937\",\n \"paymentTermsAttributes\": {\n \"paymentTermsTemplateId\": \"gid://shopify/PaymentTermsTemplate/7\",\n \"paymentSchedules\": [\n {\n \"dueAt\": \"2022-06-13T22:35:23.311Z\"\n }\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 PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) {\n paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) {\n paymentTerms {\n id\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"referenceId\" => \"gid://shopify/Order/922426937\",\n \"paymentTermsAttributes\" => [\n \"paymentTermsTemplateId\" => \"gid://shopify/PaymentTermsTemplate/7\",\n \"paymentSchedules\" => [{\"dueAt\"=>\"2022-06-13T22:35:23.311Z\"}],\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "referenceId", "description": "Specifies the reference orderId to add the payment terms for.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "referenceId", "argValue": " \"gid://shopify/Order/922426937\"", "typeKind": "MUTATION" }, { "arg": { "name": "paymentTermsAttributes", "description": "The attributes used to create the payment terms.", "type": { "kind": "INPUT_OBJECT", "name": "PaymentTermsCreateInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "PaymentTermsCreateInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "paymentTermsAttributes", "argValue": " {\"paymentTermsTemplateId\":\"gid://shopify/PaymentTermsTemplate/7\",\"paymentSchedules\":[{\"dueAt\":\"2022-06-13T22:35:23.311Z\"}]}", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "paymenttermscreate", "title": "Create net payment terms", "description": "Create payment terms that indicate payment is due a set number of days after the invoice is sent.", "query_string": "mutation PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) {\n paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) {\n paymentTerms {\n id\n }\n userErrors {\n field\n message\n }\n }\n}", "variables": { "referenceId": "gid://shopify/Order/922426937", "paymentTermsAttributes": { "paymentTermsTemplateId": "gid://shopify/PaymentTermsTemplate/2", "paymentSchedules": [ { "issuedAt": "2022-06-13T22:30:18.019Z" } ] } }, "response": { "data": { "paymentTermsCreate": { "paymentTerms": { "id": "gid://shopify/PaymentTerms/1054663033" }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/payments/payment_flexibility/test/unit/graph_api/admin/mutations/payment_terms_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 PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) { paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) { paymentTerms { id } userErrors { field message } } }\",\n \"variables\": {\n \"referenceId\": \"gid://shopify/Order/922426937\",\n \"paymentTermsAttributes\": {\n \"paymentTermsTemplateId\": \"gid://shopify/PaymentTermsTemplate/2\",\n \"paymentSchedules\": [\n {\n \"issuedAt\": \"2022-06-13T22:30:18.019Z\"\n }\n ]\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) {\n paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) {\n paymentTerms {\n id\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"referenceId\": \"gid://shopify/Order/922426937\",\n \"paymentTermsAttributes\": {\n \"paymentTermsTemplateId\": \"gid://shopify/PaymentTermsTemplate/2\",\n \"paymentSchedules\": [\n {\n \"issuedAt\": \"2022-06-13T22:30:18.019Z\"\n }\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 PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) {\n paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) {\n paymentTerms {\n id\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"referenceId\": \"gid://shopify/Order/922426937\",\n \"paymentTermsAttributes\": {\n \"paymentTermsTemplateId\": \"gid://shopify/PaymentTermsTemplate/2\",\n \"paymentSchedules\": [{\"issuedAt\"=>\"2022-06-13T22:30:18.019Z\"}]\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 PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) {\n paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) {\n paymentTerms {\n id\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"referenceId\": \"gid://shopify/Order/922426937\",\n \"paymentTermsAttributes\": {\n \"paymentTermsTemplateId\": \"gid://shopify/PaymentTermsTemplate/2\",\n \"paymentSchedules\": [\n {\n \"issuedAt\": \"2022-06-13T22:30:18.019Z\"\n }\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 PaymentTermsCreate($referenceId: ID!, $paymentTermsAttributes: PaymentTermsCreateInput!) {\n paymentTermsCreate(referenceId: $referenceId, paymentTermsAttributes: $paymentTermsAttributes) {\n paymentTerms {\n id\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"referenceId\" => \"gid://shopify/Order/922426937\",\n \"paymentTermsAttributes\" => [\n \"paymentTermsTemplateId\" => \"gid://shopify/PaymentTermsTemplate/2\",\n \"paymentSchedules\" => [{\"issuedAt\"=>\"2022-06-13T22:30:18.019Z\"}],\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "referenceId", "description": "Specifies the reference orderId to add the payment terms for.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "referenceId", "argValue": " \"gid://shopify/Order/922426937\"", "typeKind": "MUTATION" }, { "arg": { "name": "paymentTermsAttributes", "description": "The attributes used to create the payment terms.", "type": { "kind": "INPUT_OBJECT", "name": "PaymentTermsCreateInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "PaymentTermsCreateInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "paymentTermsAttributes", "argValue": " {\"paymentTermsTemplateId\":\"gid://shopify/PaymentTermsTemplate/2\",\"paymentSchedules\":[{\"issuedAt\":\"2022-06-13T22:30:18.019Z\"}]}", "typeKind": "MUTATION" } ] } ]