Skip to main content
Glama
alamedaim-apps

Authorize.net MCP Server

get_transaction_list

Retrieve all transactions from a specific settled batch in Authorize.net to review payment history and analyze settlement data.

Instructions

Get all transactions within a specific settled batch.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
batchIdYesThe batch ID to retrieve transactions for.

Implementation Reference

  • The primary handler function that implements the 'get_transaction_list' tool logic. It constructs an AuthorizeNet GetTransactionListRequest, authenticates with merchant credentials, executes the API call via a controller, parses the response, handles errors, and returns the list of transactions for the specified batch ID.
    async function getTransactionList(batchId: string) {
      const request = new ApiContracts.GetTransactionListRequest();
      request.setMerchantAuthentication(getMerchantAuth());
      request.setBatchId(batchId);
    
      const ctrl = new ApiControllers.GetTransactionListController(request.getJSON());
      const response = await executeController(ctrl);
    
      const apiResponse = new ApiContracts.GetTransactionListResponse(response);
      if (apiResponse.getMessages().getResultCode() !== ApiContracts.MessageTypeEnum.OK) {
        const errors = apiResponse.getMessages().getMessage();
        throw new Error(`API Error: ${errors[0].getCode()} - ${errors[0].getText()}`);
      }
    
      return apiResponse.getTransactions() || [];
    }
  • The JSON schema definition for the 'get_transaction_list' tool, including name, description, input schema with required 'batchId' property, provided in the ListTools response.
      name: "get_transaction_list",
      description: "Get all transactions within a specific settled batch.",
      inputSchema: {
        type: "object",
        properties: {
          batchId: {
            type: "string",
            description: "The batch ID to retrieve transactions for.",
          },
        },
        required: ["batchId"],
      },
    },
  • src/index.ts:308-310 (registration)
    The registration/dispatch logic in the CallToolRequest handler's switch statement that routes calls to the 'get_transaction_list' tool to the getTransactionList handler function.
    case "get_transaction_list":
      result = await getTransactionList(args?.batchId as string);
      break;
  • Helper function used by the handler to execute AuthorizeNet API controllers asynchronously, handling environment settings and promise resolution.
    function executeController(ctrl: any): Promise<any> {
      return new Promise((resolve, reject) => {
        if (ENVIRONMENT === "production") {
          ctrl.setEnvironment(SDKConstants.endpoint.production);
        }
        ctrl.execute(() => {
          const response = ctrl.getResponse();
          if (response === null) {
            reject(new Error(ctrl.getErrorResponse() || "No response from API"));
          } else {
            resolve(response);
          }
        });
      });
    }
  • Helper function to create the merchant authentication object using environment variables, used in all API requests including getTransactionList.
    function getMerchantAuth() {
      const merchantAuth = new ApiContracts.MerchantAuthenticationType();
      merchantAuth.setName(API_LOGIN_ID);
      merchantAuth.setTransactionKey(TRANSACTION_KEY);
      return merchantAuth;
    }

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/alamedaim-apps/authnet-mcp'

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