Docs
Servidor MCPHerramientas disponibles

Registrar pago

Registra dinero recibido o pagado y lo asigna a saldos abiertos.

Herramienta MCPrecord_payment

Propósito

Registra dinero recibido o pagado y lo asigna a saldos abiertos.

Usar cuando
Ocurrió un pago real de cliente o a proveedor.
No usar cuando
Solo corriges un saldo sin un evento de pago.
Permisos requeridos
Según input.direction: received → receivables:manage; paid → payables:manage
Efectos secundarios
Modifica datos
Idempotencia
Idempotente

Esquema de entrada

JSON Schema
{  "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    }  }}

Esquema de salida

JSON Schema
{  "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"      ]    }  ]}

Flujo relacionado

Consulta los flujos canónicos en la introducción

Herramientas relacionadas