addPayment
Apply a payment to a customer's bill in the Mews hospitality platform. Specify customer, amount, and payment method to record financial transactions.
Instructions
Adds a new payment to a customer's bill
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| CustomerId | Yes | Customer ID for the payment | |
| BillId | No | Specific bill ID to apply payment to | |
| Amount | Yes | Payment amount object | |
| PaymentMethodId | Yes | Payment method identifier | |
| Notes | No | Payment notes | |
| ConsumedUtc | No | Payment consumption date/time (ISO 8601) |
Implementation Reference
- src/tools/payments/addPayment.ts:45-58 (handler)The execute method that handles the tool logic: validates input, calls the Mews API /payments/add endpoint using mewsRequest utility, and returns the JSON result.async execute(config: MewsAuthConfig, args: unknown): Promise<ToolResult> { const inputArgs = args as Record<string, unknown>; const requestData = { ...inputArgs }; const result = await mewsRequest(config, '/api/connector/v1/payments/add', requestData); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- JSON Schema defining the input parameters for the addPayment tool, including required fields CustomerId, Amount, PaymentMethodId.inputSchema: { type: 'object', properties: { CustomerId: { type: 'string', description: 'Customer ID for the payment' }, BillId: { type: 'string', description: 'Specific bill ID to apply payment to' }, Amount: { type: 'object', properties: { Currency: { type: 'string', description: 'Payment currency code' }, Value: { type: 'number', description: 'Payment amount value' } }, required: ['Currency', 'Value'], description: 'Payment amount object' }, PaymentMethodId: { type: 'string', description: 'Payment method identifier' }, Notes: { type: 'string', description: 'Payment notes' }, ConsumedUtc: { type: 'string', description: 'Payment consumption date/time (ISO 8601)' } }, required: ['CustomerId', 'Amount', 'PaymentMethodId'], additionalProperties: false },
- src/tools/index.ts:41-41 (registration)Import statement bringing the addPaymentTool into the central tools index.import { addPaymentTool } from './payments/addPayment.js';
- src/tools/index.ts:126-126 (registration)addPaymentTool is registered by being included in the allTools array, which populates the toolMap and is used for tool definitions and execution.addPaymentTool,