---
title: "Set payment plan"
description: "Create, replace, or clear the payment terms of an unpaid PPD invoice in receivables (sent) or payables (received). Installments and overdue amounts are derived from the terms and the fiscal balance. Use the same idempotencyKey when retrying the exact change."
language: en
canonical_url: "https://exac.mx/docs/en/mcp/tools/set_payment_plan"
md_url: "https://exac.mx/docs/en/mcp/tools/set_payment_plan.md"
---

# Set payment plan

Create, replace, or clear the payment terms of an unpaid PPD invoice in receivables (sent) or payables (received). Installments and overdue amounts are derived from the terms and the fiscal balance. Use the same idempotencyKey when retrying the exact change.

Tool: `set_payment_plan`

## Purpose

Create, replace, or clear the installment terms of an unpaid PPD invoice.

### Use when

A customer or supplier payment schedule must be set or formally changed.

### Do not use when

Recording a payment, or the invoice is not an outstanding PPD invoice.

| Detail | Value |
| --- | --- |
| Permissions | By input.kind: receivable → receivables:manage; payable → payables:manage |
| Side effects | Destructive |
| Idempotency | Idempotent |

## Input schema

```json
{
  "type": "object",
  "properties": {
    "idempotencyKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Unique retry key for this exact operation. Reuse it only when retrying the same request."
    },
    "input": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "settlementTerms": {
              "$ref": "#/definitions/__schema0"
            },
            "kind": {
              "const": "receivable"
            },
            "customerId": {
              "type": "string"
            },
            "documentRef": {
              "type": "string",
              "pattern": "^cfdi:.+$"
            }
          },
          "required": [
            "settlementTerms",
            "kind",
            "customerId",
            "documentRef"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "settlementTerms": {
              "$ref": "#/definitions/__schema0"
            },
            "kind": {
              "const": "payable"
            },
            "supplierId": {
              "type": "string"
            },
            "documentRef": {
              "type": "string",
              "pattern": "^cfdi:.+$"
            }
          },
          "required": [
            "settlementTerms",
            "kind",
            "supplierId",
            "documentRef"
          ],
          "additionalProperties": false
        }
      ]
    }
  },
  "required": [
    "idempotencyKey",
    "input"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false,
  "definitions": {
    "__schema0": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "installmentCount": {
              "type": "integer",
              "minimum": 1,
              "maximum": 60
            },
            "firstDue": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "transaction_date"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "months_after_transaction"
                    },
                    "months": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 60
                    }
                  },
                  "required": [
                    "kind",
                    "months"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "fixed_date"
                    },
                    "date": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "kind",
                    "date"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "recurrence": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "anchor_day"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "day_of_month"
                    },
                    "day": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 31
                    }
                  },
                  "required": [
                    "kind",
                    "day"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "last_day"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "required": [
            "installmentCount",
            "firstDue",
            "recurrence"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
```

## Output schema

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "settlementTerms": {
          "type": "object",
          "properties": {
            "installmentCount": {
              "type": "integer",
              "minimum": 1,
              "maximum": 60
            },
            "firstDue": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "transaction_date"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "months_after_transaction"
                    },
                    "months": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 60
                    }
                  },
                  "required": [
                    "kind",
                    "months"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "fixed_date"
                    },
                    "date": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "kind",
                    "date"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "recurrence": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "anchor_day"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "day_of_month"
                    },
                    "day": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 31
                    }
                  },
                  "required": [
                    "kind",
                    "day"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "last_day"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "required": [
            "installmentCount",
            "firstDue",
            "recurrence"
          ],
          "additionalProperties": false
        },
        "paymentDueDate": {
          "type": "string"
        },
        "documentRef": {
          "type": "string",
          "pattern": "^cfdi:.+$"
        },
        "plannedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "documentRef",
        "plannedAt"
      ],
      "additionalProperties": false
    },
    "error": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "properties": {
        "code": {
          "enum": [
            "validation_error",
            "unauthenticated",
            "forbidden",
            "payment_required",
            "not_found",
            "method_not_allowed",
            "conflict",
            "idempotency_conflict",
            "operation_in_progress",
            "recovery_required",
            "migration_required",
            "rate_limited",
            "provider_unavailable",
            "internal"
          ]
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "properties": {
            "document": {
              "type": "object",
              "properties": {
                "documentRef": {
                  "type": "string",
                  "pattern": "^(cfdi|withholding|sales_receipt|declaration|tax_compliance_opinion|sales_receipt_refund):.+$"
                },
                "editable": {
                  "type": "boolean"
                }
              },
              "required": [
                "documentRef",
                "editable"
              ],
              "additionalProperties": false
            },
            "issues": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    }
                  },
                  "message": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  }
                },
                "required": [
                  "path",
                  "message"
                ],
                "additionalProperties": false
              }
            },
            "retryable": {
              "type": "boolean"
            },
            "retryAfterSeconds": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "reason": {
              "type": "string"
            },
            "balanceMinor": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "topUpUrl": {
              "type": "string"
            }
          },
          "additionalProperties": false
        }
      },
      "required": [
        "code",
        "message"
      ],
      "additionalProperties": false
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false,
  "oneOf": [
    {
      "required": [
        "data"
      ]
    },
    {
      "required": [
        "error"
      ]
    }
  ]
}
```

## Related tools

- [`get_accounts`](/docs/en/mcp/tools/get_accounts.md) — **Read accounts**: Search receivable/payable accounts or retrieve one account. Use customerId for receivables and supplierId for payables.

## Related workflow

[See the canonical workflows in the introduction](/docs/en.md)

## Equivalent REST operations

- [`PUT /v1/accounts/receivables/{customerId}/invoices/{documentRef}/plan`](/docs/en/api/accounts-payments/accounts/set-receivable-payment-plan.md)

- [`PUT /v1/accounts/payables/{supplierId}/invoices/{documentRef}/plan`](/docs/en/api/accounts-payments/accounts/set-payable-payment-plan.md)

Complete documentation: https://exac.mx/docs/en.md
Agent documentation index: https://exac.mx/docs/en/llms.txt
