---
title: "Record payment"
description: "Record money received from a customer or paid to a supplier and allocate it to open balances. Use the same idempotencyKey when retrying the exact payment."
language: en
canonical_url: "https://exac.mx/docs/en/mcp/tools/record_payment"
md_url: "https://exac.mx/docs/en/mcp/tools/record_payment.md"
---

# Record payment

Record money received from a customer or paid to a supplier and allocate it to open balances. Use the same idempotencyKey when retrying the exact payment.

Tool: `record_payment`

## Purpose

Record money received from a customer or paid to a supplier and allocate it to open balances.

### Use when

A real customer or supplier payment has occurred.

### Do not use when

You are correcting a balance without a payment event.

| Detail | Value |
| --- | --- |
| Permissions | By input.direction: received → receivables:manage; paid → payables:manage |
| Side effects | Writes data |
| 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": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "direction": {
              "type": "string",
              "const": "received"
            },
            "customerId": {
              "type": "string"
            },
            "allocations": {
              "minItems": 1,
              "type": "array",
              "items": {
                "$ref": "#/definitions/__schema0"
              }
            },
            "paymentForm": {
              "$ref": "#/definitions/__schema1"
            },
            "notes": {
              "type": "string"
            }
          },
          "required": [
            "direction",
            "customerId",
            "allocations",
            "paymentForm"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "direction": {
              "type": "string",
              "const": "paid"
            },
            "supplierId": {
              "type": "string"
            },
            "allocations": {
              "minItems": 1,
              "type": "array",
              "items": {
                "$ref": "#/definitions/__schema2"
              }
            },
            "paymentForm": {
              "$ref": "#/definitions/__schema1"
            },
            "notes": {
              "type": "string"
            }
          },
          "required": [
            "direction",
            "supplierId",
            "allocations",
            "paymentForm"
          ],
          "additionalProperties": false
        }
      ]
    }
  },
  "required": [
    "idempotencyKey",
    "input"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false,
  "definitions": {
    "__schema0": {
      "type": "object",
      "properties": {
        "documentRef": {
          "type": "string",
          "pattern": "^sales_receipt:.+$"
        },
        "amount": {
          "type": "number",
          "exclusiveMinimum": 0
        }
      },
      "required": [
        "documentRef",
        "amount"
      ],
      "additionalProperties": false
    },
    "__schema1": {
      "type": "string",
      "enum": [
        "12",
        "13",
        "14",
        "15",
        "17",
        "23",
        "24",
        "25",
        "26",
        "27",
        "28",
        "29",
        "30",
        "31",
        "99",
        "02",
        "06",
        "01",
        "05",
        "04",
        "03",
        "08"
      ],
      "description": "Active SAT payment-form code.",
      "x-exac-sat-catalog": "payment-forms"
    },
    "__schema2": {
      "type": "object",
      "properties": {
        "documentRef": {
          "type": "string",
          "pattern": "^expense:.+$"
        },
        "amount": {
          "type": "number",
          "exclusiveMinimum": 0
        }
      },
      "required": [
        "documentRef",
        "amount"
      ],
      "additionalProperties": false
    }
  }
}
```

## Output schema

```json
{
  "type": "object",
  "properties": {
    "data": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "direction": {
              "type": "string",
              "const": "received"
            },
            "paymentId": {
              "type": "string"
            },
            "customerId": {
              "type": "string",
              "minLength": 1
            },
            "amount": {
              "type": "number"
            },
            "balance": {
              "type": "number"
            },
            "businessDate": {
              "type": "string"
            },
            "paidAt": {
              "$ref": "#/definitions/__schema0"
            },
            "allocations": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "documentRef": {
                    "type": "string",
                    "pattern": "^sales_receipt:.+$"
                  },
                  "amount": {
                    "type": "number"
                  }
                },
                "required": [
                  "documentRef",
                  "amount"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "direction",
            "paymentId",
            "customerId",
            "amount",
            "balance",
            "businessDate",
            "paidAt",
            "allocations"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "direction": {
              "type": "string",
              "const": "paid"
            },
            "paymentId": {
              "type": "string"
            },
            "supplierId": {
              "type": "string",
              "minLength": 1
            },
            "amount": {
              "type": "number"
            },
            "balance": {
              "type": "number"
            },
            "businessDate": {
              "type": "string"
            },
            "paidAt": {
              "$ref": "#/definitions/__schema0"
            },
            "allocations": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "documentRef": {
                    "type": "string",
                    "pattern": "^expense:.+$"
                  },
                  "amount": {
                    "type": "number"
                  }
                },
                "required": [
                  "documentRef",
                  "amount"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "direction",
            "paymentId",
            "supplierId",
            "amount",
            "balance",
            "businessDate",
            "paidAt",
            "allocations"
          ],
          "additionalProperties": false
        }
      ]
    },
    "error": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "validation_error",
            "unauthenticated",
            "forbidden",
            "not_found",
            "method_not_allowed",
            "conflict",
            "idempotency_conflict",
            "operation_in_progress",
            "recovery_required",
            "rate_limited",
            "provider_unavailable",
            "internal"
          ]
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "properties": {
            "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
            }
          },
          "additionalProperties": false
        }
      },
      "required": [
        "code",
        "message"
      ],
      "additionalProperties": false
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false,
  "definitions": {
    "__schema0": {
      "type": "string",
      "format": "date-time"
    }
  },
  "oneOf": [
    {
      "required": [
        "data"
      ]
    },
    {
      "required": [
        "error"
      ]
    }
  ]
}
```

## Related tools

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

- [`adjust_account_balance`](/docs/en/mcp/tools/adjust_account_balance.md) — **Adjust account balance**: Correct one receivable or payable balance with an auditable reason. kind selects the account family; balanceType selects an operational document or fiscal PPD balance.

## Related workflow

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

## Equivalent REST operations

- [`POST /v1/accounts/receivables/{customerId}/payments`](/docs/en/api/accounts-payments/accounts/create-receivable-payment.md)

- [`POST /v1/accounts/payables/{supplierId}/payments`](/docs/en/api/accounts-payments/accounts/create-payable-payment.md)

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