xero_payments_create
Record a payment against an invoice by specifying invoice ID, bank account, amount, and date.
Instructions
Create a new payment in Xero. Records a payment against an invoice.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| InvoiceID | Yes | The invoice ID to apply the payment to (required) | |
| AccountID | Yes | The bank account ID the payment is made from/to (required) | |
| Amount | Yes | Payment amount (required) | |
| Date | Yes | Payment date in YYYY-MM-DD format (required) | |
| Reference | No | Payment reference |
Implementation Reference
- src/domains/payments.ts:46-76 (schema)Tool schema definition for xero_payments_create: defines name, description, and inputSchema with required fields InvoiceID, AccountID, Amount, Date and optional Reference.
{ name: "xero_payments_create", description: "Create a new payment in Xero. Records a payment against an invoice.", inputSchema: { type: "object", properties: { InvoiceID: { type: "string", description: "The invoice ID to apply the payment to (required)", }, AccountID: { type: "string", description: "The bank account ID the payment is made from/to (required)", }, Amount: { type: "number", description: "Payment amount (required)", }, Date: { type: "string", description: "Payment date in YYYY-MM-DD format (required)", }, Reference: { type: "string", description: "Payment reference", }, }, required: ["InvoiceID", "AccountID", "Amount", "Date"], }, }, - src/domains/payments.ts:112-135 (handler)Handler logic for xero_payments_create: extracts args, constructs a Payment object with Invoice, Account, Amount, Date, optional Reference, then POSTs to the Xero API 'Payments' endpoint.
case "xero_payments_create": { const { InvoiceID, AccountID, Amount, Date, Reference } = args as { InvoiceID: string; AccountID: string; Amount: number; Date: string; Reference?: string; }; const payment: Record<string, unknown> = { Invoice: { InvoiceID }, Account: { AccountID }, Amount, Date, }; if (Reference) payment.Reference = Reference; const response = await client.post("Payments", { Payments: [payment], }); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; } - src/index.ts:32-32 (registration)Import of paymentTools and handlePaymentTool from the payments domain module.
import { paymentTools, handlePaymentTool } from "./domains/payments.js"; - src/index.ts:79-80 (registration)paymentTools is included in the tools list via getDomainTools('payments') which returns the paymentTools array.
case "payments": return paymentTools; - src/index.ts:261-262 (registration)Routing: tools starting with 'xero_payments_' are dispatched to handlePaymentTool, which handles the 'xero_payments_create' case in a switch statement.
if (name.startsWith("xero_payments_")) { return await handlePaymentTool(name, toolArgs);