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
| Name | Required | Description | Default |
|---|---|---|---|
| batchId | Yes | The batch ID to retrieve transactions for. |
Implementation Reference
- src/index.ts:78-93 (handler)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() || []; }
- src/index.ts:218-230 (schema)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;
- src/index.ts:37-51 (helper)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); } }); }); }
- src/index.ts:29-34 (helper)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; }