Skip to main content
Glama
visaacceptance

Visa Acceptance

create_payment_link

Create a payment link for Visa Acceptance to let customers pay securely. Specify purchase type, amount, currency, line items, and optional requests like phone or shipping. Generate a URL for checkout.

Instructions

This tool will create a payment link in Visa Acceptance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
linkTypeYesType of payment link (PURCHASE OR DONATION)
purchaseNumberYesUnique alphanumeric id, no special chararacters for the purchase less than 20 characters
currencyYesCurrency code e.g. "USD" (Required)
totalAmountNoTotal payment amount e.g. "100.00"
requestPhoneNoRequest phone number from customer
requestShippingNoRequest shipping address from customer
clientReferenceCodeNoCustom client reference code for the transaction
lineItemsYesLine items in the purchase

Implementation Reference

  • The main handler function that executes the create_payment_link tool. It builds a Cybersource CreatePaymentLinkRequest with processing information, purchase information, order information (including amount details and line items), and client reference information. It calls the Cybersource API's createPaymentLink and returns the result.
    export const createPaymentLink = async (
      visaClient: any,
      context: VisaContext,
      params: z.infer<ReturnType<typeof createPaymentLinkParameters>>
    ) => {
      try {
        const paymentLinkApiInstance = new cybersourceRestApi.PaymentLinksApi(visaClient.configuration, visaClient.visaApiClient);
        
        const processingInformation = new cybersourceRestApi.Iplv2paymentlinksProcessingInformation(
          params.linkType, 
          params.requestPhone, 
          params.requestShipping
        );
        
        const purchaseInformation = new cybersourceRestApi.Iplv2paymentlinksPurchaseInformation(params.purchaseNumber);
        
        const amountDetails = new cybersourceRestApi.Iplv2paymentlinksOrderInformationAmountDetails(params.currency);
        amountDetails.totalAmount = params.totalAmount;
        
        const 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;
        });
        
        const orderInformation = new cybersourceRestApi.Iplv2paymentlinksOrderInformation(amountDetails, lineItems);
        
        const requestObj = new cybersourceRestApi.CreatePaymentLinkRequest(
          processingInformation,
          purchaseInformation,
          orderInformation
        );
        const clientReferenceInformation = new cybersourceRestApi.Invoicingv2invoicesClientReferenceInformation();
        if (params.clientReferenceCode) {
          clientReferenceInformation.code = params.clientReferenceCode;
        } else if (context.merchantId) {
          clientReferenceInformation.code = context.merchantId;
        }
        requestObj.clientReferenceInformation = clientReferenceInformation;
    
        
        // Initialize partner object if it doesn't exist
        requestObj.clientReferenceInformation.partner = {};
        
        // Set the developer ID based on the context mode
        setDeveloperId(requestObj, context);
        
        const result = await new Promise((resolve, reject) => {
          paymentLinkApiInstance.createPaymentLink(requestObj, (error: any, data: any) => {
            if (error) {
              reject(error);
            } else {
              resolve(data);
            }
          });
        });
        
        return result;
      } catch (error) {
        return 'Failed to create payment link';
      }
    };
  • Zod schema defining input parameters for create_payment_link: linkType, purchaseNumber, currency, totalAmount (optional), requestPhone (optional boolean, default false), requestShipping (optional boolean, default false), clientReferenceCode (optional), and lineItems (optional array of product objects).
    export const createPaymentLinkParameters = (
      context: VisaContext = {} as VisaContext
    ) => {
      return z.object({
        linkType: z.string().describe('Type of payment link (PURCHASE OR DONATION)'),
        purchaseNumber: z.string().describe('Unique alphanumeric id, no special chararacters for the purchase less than 20 characters'),
        currency: z.string().describe('Currency code e.g. "USD" (Required)'),
        totalAmount: z.string().optional().describe('Total payment amount e.g. "100.00"'),
        requestPhone: z.boolean().optional().default(false).describe('Request phone number from customer'),
        requestShipping: z.boolean().optional().default(false).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')
          })
        ).describe('Line items in the purchase')
      });
    };
  • Tool registration object. Sets method to 'create_payment_link', name to 'Create Payment Link', wires up the prompt, parameters, actions (paymentLinks.create), and execute handler.
    const tool = (context: VisaContext): Tool => ({
      method: 'create_payment_link',
      name: 'Create Payment Link',
      description: createPaymentLinkPrompt(context),
      parameters: createPaymentLinkParameters(context),
      actions: {
        paymentLinks: {
          create: true,
        },
      },
      execute: createPaymentLink,
    });
    
    export default tool;
  • The createTools function that compiles all tools into an array. Line 48 invokes createPaymentLinkToolModule(context) to include it 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 setDeveloperId that sets the developer ID on the request object's clientReferenceInformation.partner.developerId based on context mode (N05YN5UH for modelcontextprotocol, A2R8EP3K otherwise).
    export function setDeveloperId(requestObj: any, context: VisaContext): any {
      // Initialize clientReferenceInformation if it doesn't exist
      if (!requestObj.clientReferenceInformation) {
        requestObj.clientReferenceInformation = {};
      }
      
      // Initialize partner object if it doesn't exist
      if (!requestObj.clientReferenceInformation.partner) {
        requestObj.clientReferenceInformation.partner = {};
      }
      // Set the developer ID based on the context mode
      requestObj.clientReferenceInformation.partner.developerId = 
        context?.mode === 'modelcontextprotocol' ? 'N05YN5UH' : 'A2R8EP3K';
        
      
      return requestObj;
    }
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states the creation action without any details on side effects, required permissions, idempotency, or error conditions. This is insufficient for safe invocation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence of 11 words, which is concise but overly sparse. It lacks important details that could be included without verbosity, such as default behavior or output format.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 8 parameters, no output schema, and no annotations, the description fails to provide necessary context about return values, error handling, or invocation requirements. It is incomplete for an agent to use safely and effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% parameter description coverage, so the schema already documents each parameter. The tool description adds no extra meaning beyond what is in the schema, meeting the baseline expectation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action 'create' and the resource 'payment link' within 'Visa Acceptance', making the tool's purpose immediately understandable. However, it does not differentiate from sibling tools like update_payment_link or get_payment_link, but the verb 'create' is distinct enough among them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as update_payment_link or create_invoice. The description lacks any contextual cues or exclusions, leaving the agent to infer usage solely from the name.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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