get_payment_link
Retrieve a specific payment link from Visa Acceptance using its unique ID to access payment details and transaction 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: retrieves a specific payment link by ID using the CyberSource REST API PaymentLinksApi.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 tool: a required string 'id' for the payment link ID.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 registration object definition, exporting a function that returns the Tool config with method 'get_payment_link', linking to schema, description, and 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:50-50 (registration)Inclusion of the get_payment_link tool in the central createTools function that aggregates all tools.getPaymentLinkToolModule(context),
- typescript/src/shared/tools.ts:23-23 (registration)Import of the getPaymentLink tool module for registration in the tools list.import getPaymentLinkToolModule from './paymentLinks/getPaymentLink';