list_payment_links
Retrieve and manage payment links from Visa Acceptance by filtering status and using pagination to view transaction records.
Instructions
This tool will list payment links from Visa Acceptance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| offset | Yes | Pagination offset (required) | |
| limit | Yes | Pagination limit (required) | |
| status | No | Filter by status (optional) |
Implementation Reference
- The main handler function that executes the logic to list payment links using the CyberSource PaymentLinksApi.export const listPaymentLinks = async ( visaClient: any, context: VisaContext, params: z.infer<ReturnType<typeof listPaymentLinksParameters>> ) => { try { const paymentLinkApiInstance = new cybersourceRestApi.PaymentLinksApi(visaClient.configuration, visaClient.visaApiClient); const opts: { status?: string } = {}; if (params.status) { opts.status = params.status; } const result = await new Promise((resolve, reject) => { paymentLinkApiInstance.getAllPaymentLinks( params.offset, params.limit, opts, (error: any, data: any) => { if (error) { reject(error); } else { resolve(data); } } ); }); return result; } catch (error) { return 'Failed to list payment links'; } };
- Zod schema defining the input parameters: offset (number, required), limit (number, required), status (string, optional).export const listPaymentLinksParameters = ( context: VisaContext = {} as VisaContext ) => { return z.object({ offset: z.number().describe('Pagination offset (required)'), limit: z.number().describe('Pagination limit (required)'), status: z.string().optional().describe('Filter by status (optional)') }); };
- typescript/src/shared/paymentLinks/listPaymentLinks.ts:65-78 (registration)Defines and exports the tool object with method 'list_payment_links', linking the schema, description, and handler.const tool = (context: VisaContext): Tool => ({ method: 'list_payment_links', name: 'List Payment Links', description: listPaymentLinksPrompt(context), parameters: listPaymentLinksParameters(context), actions: { paymentLinks: { read: true, }, }, execute: listPaymentLinks, }); export default tool;
- typescript/src/shared/tools.ts:40-53 (registration)Registers the listPaymentLinks tool (imported as listPaymentLinkToolModule) into the central tools array via createTools function.export function createTools(context: VisaContext): Tool[] { return [ createInvoiceToolModule(context), updateInvoiceToolModule(context), getInvoiceToolModule(context), listInvoicesToolModule(context), sendInvoiceToolModule(context), cancelInvoiceToolModule(context), createPaymentLinkToolModule(context), updatePaymentLinkToolModule(context), getPaymentLinkToolModule(context), listPaymentLinkToolModule(context) ]; }