chargeCreditCard
Process credit card payments to settle customer bills within the Mews hospitality platform. This tool securely charges cards and automatically applies payments to outstanding balances.
Instructions
Charges a credit card and adds the resulting payment to a customer bill
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| CustomerId | Yes | Customer ID for the charge | |
| Amount | Yes | Charge amount object | |
| CreditCardData | Yes | Credit card information | |
| BillId | No | Specific bill ID to apply charge to | |
| Notes | No | Charge notes |
Implementation Reference
- The async execute function that implements the core logic of the chargeCreditCard tool by forwarding input arguments to the Mews API endpoint '/api/connector/v1/payments/chargeCreditCard' via mewsRequest.
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/chargeCreditCard', requestData); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } - Input schema defining the required and optional parameters for the chargeCreditCard tool, including CustomerId, Amount (with Currency and Value), CreditCardData (with Number, Expiry, Name, optional SecurityCode), optional BillId and Notes.
inputSchema: { type: 'object', properties: { CustomerId: { type: 'string', description: 'Customer ID for the charge' }, Amount: { type: 'object', properties: { Currency: { type: 'string', description: 'Charge currency code' }, Value: { type: 'number', description: 'Charge amount value' } }, required: ['Currency', 'Value'], description: 'Charge amount object' }, CreditCardData: { type: 'object', properties: { Number: { type: 'string', description: 'Credit card number' }, Expiry: { type: 'string', description: 'Expiry date (MM/YY)' }, Name: { type: 'string', description: 'Cardholder name' }, SecurityCode: { type: 'string', description: 'CVV/CVC code' } }, required: ['Number', 'Expiry', 'Name'], description: 'Credit card information' }, BillId: { type: 'string', description: 'Specific bill ID to apply charge to' }, Notes: { type: 'string', description: 'Charge notes' } }, required: ['CustomerId', 'Amount', 'CreditCardData'], additionalProperties: false }, - src/tools/index.ts:126-128 (registration)Registration of the chargeCreditCardTool in the central allTools array, which is used to create the tool registry and map for execution.
addPaymentTool, chargeCreditCardTool, getAllPaymentsTool,