Anchor to paymentTermsUpdatepayment
paymentTermsUpdate
mutation
Requires access scope. Also: User must have either orders or draft orders access according to the reference.
Update payment terms on an order. To update payment terms on a draft order, use a draft order mutation and include the request with the .
Anchor to Arguments
Arguments
- Anchor to inputinput•Payment
Terms requiredUpdate Input! The input fields used to update the payment terms.
Was this section helpful?
Anchor to PaymentTermsUpdatePayload returnsPaymentTermsUpdatePayload returns
- Anchor to paymentTermspayment•
Terms The updated payment terms.
- Anchor to userErrorsuser•
Errors [PaymentTerms non-nullUpdate User Error!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
- Update payment terms date
- Update payment terms type
- paymentTermsUpdate reference
Examples
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 mutation PaymentTermsUpdate($input: PaymentTermsUpdateInput!) {6 paymentTermsUpdate(input: $input) {7 paymentTerms {8 id9 }10 userErrors {11 code12 field13 message14 }15 }16 }`,17 {18 variables: {19 "input": {20 "paymentTermsId": "gid://shopify/PaymentTerms/977822362",21 "paymentTermsAttributes": {22 "paymentTermsTemplateId": "gid://shopify/PaymentTermsTemplate/7",23 "paymentSchedules": [24 {25 "dueAt": "2022-06-13T22:35:23.311Z"26 }27 ]28 }29 }30 },31 },32);3334const data = await response.json();35
mutation PaymentTermsUpdate($input: PaymentTermsUpdateInput!) {
paymentTermsUpdate(input: $input) {
paymentTerms {
id
}
userErrors {
code
field
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation PaymentTermsUpdate($input: PaymentTermsUpdateInput!) { paymentTermsUpdate(input: $input) { paymentTerms { id } userErrors { code field message } } }",
"variables": {
"input": {
"paymentTermsId": "gid://shopify/PaymentTerms/977822362",
"paymentTermsAttributes": {
"paymentTermsTemplateId": "gid://shopify/PaymentTermsTemplate/7",
"paymentSchedules": [
{
"dueAt": "2022-06-13T22:35:23.311Z"
}
]
}
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation PaymentTermsUpdate($input: PaymentTermsUpdateInput!) {
paymentTermsUpdate(input: $input) {
paymentTerms {
id
}
userErrors {
code
field
message
}
}
}`,
{
variables: {
"input": {
"paymentTermsId": "gid://shopify/PaymentTerms/977822362",
"paymentTermsAttributes": {
"paymentTermsTemplateId": "gid://shopify/PaymentTermsTemplate/7",
"paymentSchedules": [
{
"dueAt": "2022-06-13T22:35:23.311Z"
}
]
}
}
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation PaymentTermsUpdate($input: PaymentTermsUpdateInput!) {
paymentTermsUpdate(input: $input) {
paymentTerms {
id
}
userErrors {
code
field
message
}
}
}`,
"variables": {
"input": {
"paymentTermsId": "gid://shopify/PaymentTerms/977822362",
"paymentTermsAttributes": {
"paymentTermsTemplateId": "gid://shopify/PaymentTermsTemplate/7",
"paymentSchedules": [
{
"dueAt": "2022-06-13T22:35:23.311Z"
}
]
}
}
},
},
});
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 PaymentTermsUpdate($input: PaymentTermsUpdateInput!) {
paymentTermsUpdate(input: $input) {
paymentTerms {
id
}
userErrors {
code
field
message
}
}
}
QUERY
variables = {
"input": {
"paymentTermsId": "gid://shopify/PaymentTerms/977822362",
"paymentTermsAttributes": {
"paymentTermsTemplateId": "gid://shopify/PaymentTermsTemplate/7",
"paymentSchedules": [{"dueAt"=>"2022-06-13T22:35:23.311Z"}]
}
}
}
response = client.query(query: query, variables: variables)
Input variables
JSON1{2 "input": {3 "paymentTermsId": "gid://shopify/PaymentTerms/977822362",4 "paymentTermsAttributes": {5 "paymentTermsTemplateId": "gid://shopify/PaymentTermsTemplate/7",6 "paymentSchedules": [7 {8 "dueAt": "2022-06-13T22:35:23.311Z"9 }10 ]11 }12 }13}
Response
JSON1{2 "paymentTermsUpdate": {3 "paymentTerms": {4 "id": "gid://shopify/PaymentTerms/977822362"5 },6 "userErrors": []7 }8}