Anchor to section titled 'undefined'

paymentTermsDelete
mutation

Requires write_payment_terms access scope. Also: User must have either orders or draft orders access according to the reference.

Delete payment terms for an order. To delete payment terms on a draft order, use a draft order mutation and include the request with the DraftOrderInput.


The input fields used to delete the payment terms.


Was this section helpful?

The deleted payment terms ID.

The list of errors that occurred from executing the mutation.


Was this section helpful?

Examples

Hide code
DescriptionCopy
mutation PaymentTermsDelete($input: PaymentTermsDeleteInput!) {
  paymentTermsDelete(input: $input) {
    deletedId
    userErrors {
      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 PaymentTermsDelete($input: PaymentTermsDeleteInput!) { paymentTermsDelete(input: $input) { deletedId userErrors { field message } } }",
 "variables": {
    "input": {
      "paymentTermsId": "gid://shopify/PaymentTerms/977822362"
    }
  }
}'
const { admin } = await authenticate.admin(request);

const response = await admin.graphql(
  `#graphql
  mutation PaymentTermsDelete($input: PaymentTermsDeleteInput!) {
    paymentTermsDelete(input: $input) {
      deletedId
      userErrors {
        field
        message
      }
    }
  }`,
  {
    variables: {
      "input": {
        "paymentTermsId": "gid://shopify/PaymentTerms/977822362"
      }
    },
  },
);

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 PaymentTermsDelete($input: PaymentTermsDeleteInput!) {
    paymentTermsDelete(input: $input) {
      deletedId
      userErrors {
        field
        message
      }
    }
  }
QUERY

variables = {
  "input": {
    "paymentTermsId": "gid://shopify/PaymentTerms/977822362"
  }
}

response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
  data: {
    "query": `mutation PaymentTermsDelete($input: PaymentTermsDeleteInput!) {
      paymentTermsDelete(input: $input) {
        deletedId
        userErrors {
          field
          message
        }
      }
    }`,
    "variables": {
      "input": {
        "paymentTermsId": "gid://shopify/PaymentTerms/977822362"
      }
    },
  },
});
use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
  mutation PaymentTermsDelete($input: PaymentTermsDeleteInput!) {
    paymentTermsDelete(input: $input) {
      deletedId
      userErrors {
        field
        message
      }
    }
  }
QUERY;

$variables = [
  "input" => [
    "paymentTermsId" => "gid://shopify/PaymentTerms/977822362",
  ],
];

$response = $client->query(["query" => $query, "variables" => $variables]);
Hide code
Input variables
Copy
{
  "input": {
    "paymentTermsId": "gid://shopify/PaymentTerms/977822362"
  }
}
Hide code
Response
JSON
{
  "paymentTermsDelete": {
    "deletedId": "gid://shopify/PaymentTerms/977822362",
    "userErrors": []
  }
}