get_payment_link
Retrieve a specific payment link from Visa Acceptance using its unique ID to access payment details and processing information.
Instructions
This tool will get a specific payment link from Visa Acceptance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Payment link ID (required) |
Implementation Reference
- The main handler function that executes the tool logic by calling the Cybersource PaymentLinksApi to retrieve a payment link by ID.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'; } };
- Zod schema defining the input parameters for the get_payment_link tool: requires 'id' string.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)Tool object definition registering 'get_payment_link' with 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)Aggregation function that includes the getPaymentLinkToolModule (imported at line 23) in the list of available tools.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 providing the tool description/prompt.export const getPaymentLinkPrompt = (context: VisaContext = {} as VisaContext) => ` This tool will get a specific payment link from Visa Acceptance. `;