UNPKG

quickbooks-api

Version:

A modular TypeScript SDK for seamless integration with Intuit QuickBooks APIs. Provides robust authentication handling and future-ready foundation for accounting, payments, and commerce operations.

27 lines (26 loc) 842 B
/** * Get Payment by ID * @param this - The Payment API * @param id - The ID of the payment * @returns The Payment */ export async function getPaymentById(id, options = {}) { // Get the Query Builder const queryBuilder = await this.getQueryBuilder(); // Setup ID Filter queryBuilder.whereId(id); // Setup the Search Options (if provided) if (options.searchOptions) queryBuilder.setSearchOptions(options.searchOptions); // Setup the URL const url = queryBuilder.build(); // Get the Payment const response = await this.apiClient.runRequest(url, { method: 'GET' }); // Check if the Response Failed to find an Payment if (!response) return null; // Format the Response const payments = this.formatResponse(response); // Return the Payment return payments[0]; }