Anchor to section titled 'undefined'

paymentTermsUpdate
mutation

Requires write_payment_terms 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 DraftOrderInput.


The input fields used to update the payment terms.


Was this section helpful?

The updated payment terms.

The list of errors that occurred from executing the mutation.


Was this section helpful?

Examples

Hide code
DescriptionCopy
mutation PaymentTermsUpdate($input: PaymentTermsUpdateInput!) {
  paymentTermsUpdate(input: $input) {
    paymentTerms {
      id
    }
    userErrors {
      code
      field
      message
    }
  }
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-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();
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)
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"
            }
          ]
        }
      }
    },
  },
});
use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$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]);
Hide code
Input variables
Copy
{
  "input": {
    "paymentTermsId": "gid://shopify/PaymentTerms/977822362",
    "paymentTermsAttributes": {
      "paymentTermsTemplateId": "gid://shopify/PaymentTermsTemplate/7",
      "paymentSchedules": [
        {
          "dueAt": "2022-06-13T22:35:23.311Z"
        }
      ]
    }
  }
}
Hide code
Response
JSON
{
  "paymentTermsUpdate": {
    "paymentTerms": {
      "id": "gid://shopify/PaymentTerms/977822362"
    },
    "userErrors": []
  }
}