get_payment_link
Retrieve details of a specific payment link from Visa Acceptance by providing its ID. Access payment link information for processing or verification.
Instructions
This tool will get a specific payment link from Visa Acceptance.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Payment link ID (required) |
Implementation Reference
- The main handler function that executes the 'get_payment_link' tool logic. It calls the Cybersource PaymentLinksApi.getPaymentLink API with the provided ID parameter.
export const getPaymentLink = async ( visaClient: any, context: VisaContext, params: z.infer<ReturnType<typeof getPaymentLinkParameters>> ) => { try { const paymentLinkApiInstance = new cybersourceRestApi.PaymentLinksApi(visaClient.configuration, visaClient.visaApiClient); const result = await new Promise((resolve, reject) => { paymentLinkApiInstance.getPaymentLink(params.id, (error: any, data: any) => { if (error) { reject(error); } else { resolve(data); } }); }); return result; } catch (error) { return 'Failed to get payment link'; } }; - Input parameter schema for the 'get_payment_link' tool, defining the 'id' field as a required string using Zod.
export const getPaymentLinkParameters = ( context: VisaContext = {} as VisaContext ) => { return z.object({ id: z.string().describe('Payment link ID (required)') }); }; - typescript/src/shared/paymentLinks/getPaymentLink.ts:54-67 (registration)Registration of the tool as a Tool object with method 'get_payment_link', name, description, parameters, actions, and execute handler.
const tool = (context: VisaContext): Tool => ({ method: 'get_payment_link', name: 'Get Payment Link', description: getPaymentLinkPrompt(context), parameters: getPaymentLinkParameters(context), actions: { paymentLinks: { read: true, }, }, execute: getPaymentLink, }); export default tool; - typescript/src/shared/tools.ts:40-53 (registration)The 'createTools' function that aggregates all tools, including getPaymentLinkToolModule, into a Tool array for the MCP server.
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) ]; } - Helper function that returns the prompt/description string for the 'get_payment_link' tool.
export const getPaymentLinkPrompt = (context: VisaContext = {} as VisaContext) => ` This tool will get a specific payment link from Visa Acceptance. `;