UNPKG

bc-payments-sdk

Version:

BetterCommerce's Payments NodeJS SDK is a complete solution for storefront clients that integrate payments. `bc-payments-sdk` is a single point interface for storefront clients for interacting with payment gateways.

20 lines (19 loc) 1.14 kB
/** * Makes an HTTP request using the specified parameters and returns the response data or an error object. * * @param {string} url - The endpoint URL for the request. * @param {string} method - The HTTP method to use (e.g., 'post', 'get'). * @param {object} data - The data to send in the request body (for POST/PUT requests). * @param {object} params - The URL parameters to include in the request. * @param {object} headers - The headers to include in the request. * @param {object} cookies - Cookies to use for setting additional headers like Currency, Language, etc. * @param {string} baseUrl - The base URL to use if not specified in the environment config. * * @returns {Promise<any>} The response data if the request is successful, or an error object if it fails. * * @throws {InvalidRequestException} If the response status is 400 or 404. * @throws {AuthenticationException} If the response status is 401. * @throws {APIException} For any other non-2xx response status. */ declare const fetcher: ({ url, method, data, params, headers, cookies, baseUrl, logRequest, }: any) => Promise<any>; export default fetcher;