Skip to main content
Glama
visaacceptance

Visa Acceptance

update_payment_link

Modify payment link details in Visa Acceptance, including amount, currency, expiration, and customer data requirements for purchases or donations.

Instructions

This tool will update a payment link in Visa Acceptance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesPayment link ID (required)
linkTypeNoType of payment link (PURCHASE OR DONATION)
purchaseNumberNoUnique identifier for the purchase
currencyNoCurrency code e.g. "USD"
totalAmountNoTotal payment amount e.g. "100.00"
requestPhoneNoRequest phone number from customer
requestShippingNoRequest shipping address from customer
clientReferenceCodeNoCustom client reference code for the transaction
lineItemsNoLine items in the purchase
expirationDaysNoNumber of days the link remains valid

Implementation Reference

  • The handler function that performs the actual update of the payment link using the CyberSource REST API.
    export const updatePaymentLink = async ( visaClient: any, context: VisaContext, params: z.infer<ReturnType<typeof updatePaymentLinkParameters>> ) => { try { const paymentLinkApiInstance = new cybersourceRestApi.PaymentLinksApi(visaClient.configuration, visaClient.visaApiClient); const { id, ...updateParams } = params; let expirationDate; if (params.expirationDays) { expirationDate = new Date(Date.now() + params.expirationDays * 24 * 60 * 60 * 1000).toISOString().split('T')[0]; } /** * Create the SDK model objects for the payment link update */ let processingInformation; if (params.linkType) { processingInformation = new cybersourceRestApi.Iplv2paymentlinksProcessingInformation( params.linkType, params.requestPhone, params.requestShipping ); } let purchaseInformation; if (params.purchaseNumber) { purchaseInformation = new cybersourceRestApi.Iplv2paymentlinksPurchaseInformation(params.purchaseNumber); } let amountDetails; let orderInformation; if (params.currency) { amountDetails = new cybersourceRestApi.Iplv2paymentlinksOrderInformationAmountDetails(params.currency); if (params.totalAmount) { amountDetails.totalAmount = params.totalAmount; } let lineItems; if (params.lineItems && params.lineItems.length > 0) { lineItems = params.lineItems.map((item: LineItem) => { const lineItem = new cybersourceRestApi.Iplv2paymentlinksOrderInformationLineItems(item.productName); lineItem.productSku = item.productSKU; lineItem.productDescription = item.productDescription; lineItem.quantity = parseInt(item.quantity, 10); lineItem.unitPrice = item.unitPrice; return lineItem; }); orderInformation = new cybersourceRestApi.Iplv2paymentlinksOrderInformation(amountDetails, lineItems); } else if (amountDetails) { orderInformation = new cybersourceRestApi.Iplv2paymentlinksOrderInformation(amountDetails); } } const requestObj = new cybersourceRestApi.UpdatePaymentLinkRequest(); if (processingInformation) { requestObj.processingInformation = processingInformation; } if (purchaseInformation) { requestObj.purchaseInformation = purchaseInformation; } if (orderInformation) { requestObj.orderInformation = orderInformation; } const clientReferenceInformation = new cybersourceRestApi.Invoicingv2invoicesClientReferenceInformation(); if (params.clientReferenceCode) { clientReferenceInformation.code = params.clientReferenceCode; } else if (context.merchantId) { clientReferenceInformation.code = context.merchantId; } requestObj.clientReferenceInformation = clientReferenceInformation; const result = await new Promise((resolve, reject) => { paymentLinkApiInstance.updatePaymentLink(id, requestObj, (error: any, data: any) => { if (error) { reject(error); } else { resolve(data); } }); }); return result; } catch (error) { return 'Failed to update payment link'; } };
  • Zod schema defining the input parameters for the update_payment_link tool.
    export const updatePaymentLinkParameters = ( context: VisaContext = {} as VisaContext ) => { return z.object({ id: z.string().describe('Payment link ID (required)'), linkType: z.string().optional().describe('Type of payment link (PURCHASE OR DONATION)'), purchaseNumber: z.string().optional().describe('Unique identifier for the purchase'), currency: z.string().optional().describe('Currency code e.g. "USD"'), totalAmount: z.string().optional().describe('Total payment amount e.g. "100.00"'), requestPhone: z.boolean().optional().describe('Request phone number from customer'), requestShipping: z.boolean().optional().describe('Request shipping address from customer'), clientReferenceCode: z.string().optional().describe('Custom client reference code for the transaction'), lineItems: z.array( z.object({ productName: z.string().describe('Name of the product'), productSKU: z.string().optional().describe('Product SKU identifier'), productDescription: z.string().optional().describe('Product description'), quantity: z.string().describe('Quantity of the product'), unitPrice: z.string().describe('Unit price of the product') }) ).optional().describe('Line items in the purchase'), expirationDays: z.number().optional().describe('Number of days the link remains valid') }); };
  • Local registration of the tool module, exporting the Tool object with method name, description, parameters, and execute handler.
    const tool = (context: VisaContext): Tool => ({ method: 'update_payment_link', name: 'Update Payment Link', description: updatePaymentLinkPrompt(context), parameters: updatePaymentLinkParameters(context), actions: { paymentLinks: { update: true, }, }, execute: updatePaymentLink, }); export default tool;
  • Global registration where the updatePaymentLink tool module is included in the array of all 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) ];
  • Import of the updatePaymentLink tool module.
    import updatePaymentLinkToolModule from './paymentLinks/updatePaymentLink';

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/visaacceptance/agent-toolkit'

If you have feedback or need assistance with the MCP directory API, please join our Discord server