### Add and Run an Example Source: https://github.com/lithic-com/lithic-node/blob/main/CONTRIBUTING.md Add new example files to the `examples/` directory and make them executable. Run examples against your API using `yarn tsn`. ```ts // add an example to examples/.ts #!/usr/bin/env -S npm run tsn -T … ``` ```sh $ chmod +x examples/.ts # run the example against your api $ yarn tsn -T examples/.ts ``` -------------------------------- ### Install Dependencies and Build Project Source: https://github.com/lithic-com/lithic-node/blob/main/CONTRIBUTING.md Run these commands to install all necessary dependencies and build the project output files. ```sh $ yarn $ yarn build ``` -------------------------------- ### Bun @types/bun Installation Source: https://github.com/lithic-com/lithic-node/blob/main/MIGRATION.md Install the `@types/bun` package for Bun environments. Version 1.2.0 or higher is recommended. ```json { "devDependencies": { "@types/bun": ">= 1.2.0" } } ``` -------------------------------- ### Send Simulated Example Event Subscription Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Sends a simulated example event for a specific event subscription. ```APIDOC ## POST /v1/simulate/event_subscriptions/{event_subscription_token}/send_example ### Description Sends a simulated example event for a specific event subscription. ### Method POST ### Endpoint /v1/simulate/event_subscriptions/{event_subscription_token}/send_example ### Parameters #### Path Parameters - **eventSubscriptionToken** (string) - Required - The unique identifier for the event subscription. #### Request Body - **params** (object) - Required - Parameters for sending the simulated example. ### Response #### Success Response (200) - Returns void. #### Response Example { "example": "void" } ``` -------------------------------- ### Install from Git Source: https://github.com/lithic-com/lithic-node/blob/main/CONTRIBUTING.md Use this command to install the lithic-node package directly from its GitHub repository via SSH. ```sh $ npm install git+ssh://git@github.com:lithic-com/lithic-node.git ``` -------------------------------- ### Node.js @types/node Installation Source: https://github.com/lithic-com/lithic-node/blob/main/MIGRATION.md Install the appropriate `@types/node` package for Node.js environments to resolve type errors. Version 20 or higher is recommended. ```json { "devDependencies": { "@types/node": ">= 20" } } ``` -------------------------------- ### Run Mock Server Source: https://github.com/lithic-com/lithic-node/blob/main/CONTRIBUTING.md Start a mock server using the provided script. This is often required for running tests. ```sh $ ./scripts/mock ``` -------------------------------- ### Configure Proxy for Bun Source: https://github.com/lithic-com/lithic-node/blob/main/README.md Configure proxy settings directly within fetchOptions for Bun runtime. This simplifies proxy setup for Bun applications. ```typescript import Lithic from 'lithic'; const client = new Lithic({ fetchOptions: { proxy: 'http://localhost:8888', }, }); ``` -------------------------------- ### Install Lithic MCP Server via npx Source: https://github.com/lithic-com/lithic-node/blob/main/packages/mcp-server/README.md Run the MCP Server directly using npx. Ensure environment variables for API key, webhook secret, and environment are set. ```sh export LITHIC_API_KEY="My Lithic API Key" export LITHIC_WEBHOOK_SECRET="My Webhook Secret" export LITHIC_ENVIRONMENT="production" npx -y lithic-mcp@latest ``` -------------------------------- ### MCP Server Configuration JSON Source: https://github.com/lithic-com/lithic-node/blob/main/packages/mcp-server/README.md Example configuration JSON for clients that support MCP server configuration. This specifies the command, arguments, and environment variables for launching the Lithic MCP server. ```json { "mcpServers": { "lithic_api": { "command": "npx", "args": ["-y", "lithic-mcp"], "env": { "LITHIC_API_KEY": "My Lithic API Key", "LITHIC_WEBHOOK_SECRET": "My Webhook Secret", "LITHIC_ENVIRONMENT": "production" } } } } ``` -------------------------------- ### Configure Proxy for Node.js with Undici Source: https://github.com/lithic-com/lithic-node/blob/main/README.md Use custom fetchOptions with a ProxyAgent from undici to route requests through a proxy in Node.js environments. Ensure undici is installed. ```typescript import Lithic from 'lithic'; import * as undici from 'undici'; const proxyAgent = new undici.ProxyAgent('http://localhost:8888'); const client = new Lithic({ fetchOptions: { dispatcher: proxyAgent, }, }); ``` -------------------------------- ### Cloudflare Workers @cloudflare/workers-types Installation Source: https://github.com/lithic-com/lithic-node/blob/main/MIGRATION.md Install the `@cloudflare/workers-types` package for Cloudflare Workers environments. A version greater than or equal to 0.20221111.0 is required. ```json { "devDependencies": { "@cloudflare/workers-types": ">= 0.20221111.0" } } ``` -------------------------------- ### Get Embed HTML Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Asynchronously retrieves the HTML content for embedding a card. ```typescript client.cards.getEmbedHTML(...args) -> Promise ``` -------------------------------- ### client.cards.list Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Lists all cards. This method corresponds to the GET /v1/cards endpoint. ```APIDOC ## GET /v1/cards ### Description Lists all cards. ### Method GET ### Endpoint /v1/cards ### Parameters #### Query Parameters - **params** (object) - Optional - An object containing query parameters for filtering the list. ### Response #### Success Response (200) - **NonPCICardsCursorPage** (object) - A paginated list of non-PCI cards. #### Response Example ```json { "example": "response body for list cards" } ``` ``` -------------------------------- ### client.cards.balances.list Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Lists balances for a card. This method corresponds to the GET /v1/cards/{card_token}/balances endpoint. ```APIDOC ## GET /v1/cards/{card_token}/balances ### Description Lists balances for a card. ### Method GET ### Endpoint /v1/cards/{card_token}/balances ### Parameters #### Path Parameters - **cardToken** (string) - Required - The unique identifier for the card. #### Query Parameters - **params** (object) - Optional - An object containing query parameters for filtering balances. ### Response #### Success Response (200) - **FinancialAccountBalancesSinglePage** (object) - A paginated list of financial account balances. #### Response Example ```json { "example": "response body for card balances" } ``` ``` -------------------------------- ### client.payments.list Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Lists all payments. This method sends a GET request to the /v1/payments endpoint and returns a PaymentsCursorPage. ```APIDOC ## GET /v1/payments ### Description Lists all payments. ### Method GET ### Endpoint /v1/payments ### Parameters #### Query Parameters - **params** (object) - Optional - An object containing query parameters for filtering and pagination. ### Response #### Success Response (200) - **PaymentsCursorPage** (object) - A cursor-paginated page of payments. #### Response Example ```json { "example": "response body for list payments" } ``` ``` -------------------------------- ### Express.js Webhook Handler Source: https://github.com/lithic-com/lithic-node/blob/main/README.md Example of a full webhook handler using Express.js, including parsing the raw request body. ```javascript app.use('/webhooks/lithic', bodyParser.text({ type: '*/*' }), function (req, res) { const event = lithic.webhooks.parse(req.body, { headers: req.headers }); console.log(event); res.json({ ok: true }); }); ``` -------------------------------- ### Next.js App Router Webhook Handler Source: https://github.com/lithic-com/lithic-node/blob/main/README.md Example of a webhook handler for Next.js using the App Router, including reading the raw request body and headers. ```typescript export default async function POST(req: Request) { const body = await req.text(); const event = lithic.webhooks.parse(body, { headers: Object.fromEntries(req.headers) }); console.log(event); return NextResponse.json({ ok: true }); } ``` -------------------------------- ### client.creditProducts.primeRates.create Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Creates prime rates for a given credit product token. ```APIDOC ## POST /v1/credit_products/{credit_product_token}/prime_rates ### Description Creates or updates prime rates for a specified credit product. ### Method POST ### Endpoint /v1/credit_products/{credit_product_token}/prime_rates ### Parameters #### Path Parameters - **creditProductToken** (string) - Required - The unique identifier for the credit product. #### Request Body - **params** (object) - Required - An object containing parameters for creating prime rates. ``` -------------------------------- ### Initialize Lithic Client and Create Card Source: https://github.com/lithic-com/lithic-node/blob/main/README.md Instantiate the Lithic client with an API key and environment, then create a single-use card. The API key defaults to the LITHIC_API_KEY environment variable, and the environment defaults to 'production'. ```javascript import Lithic from 'lithic'; const client = new Lithic({ apiKey: process.env['LITHIC_API_KEY'], // This is the default and can be omitted environment: 'sandbox', // defaults to 'production' }); const card = await client.cards.create({ type: 'SINGLE_USE' }); console.log(card.token); ``` -------------------------------- ### Access Resource Classes Source: https://github.com/lithic-com/lithic-node/blob/main/MIGRATION.md Demonstrates the correct way to import resource classes, either as static properties of the main client or directly from their definition files. ```javascript // Before const { Accounts } = require('lithic'); // After const { Lithic } = require('lithic'); Lithic.Accounts; // or import directly from lithic/resources/accounts ``` -------------------------------- ### Get Embed URL Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Retrieves the URL for embedding a card. ```typescript client.cards.getEmbedURL(...args) -> string ``` -------------------------------- ### Configure Proxy for Deno Source: https://github.com/lithic-com/lithic-node/blob/main/README.md Utilize Deno.createHttpClient to configure proxy settings for Deno runtime. The httpClient is then passed via fetchOptions. ```typescript import Lithic from 'npm:lithic'; const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } }); const client = new Lithic({ fetchOptions: { client: httpClient, }, }); ``` -------------------------------- ### Run Tests Source: https://github.com/lithic-com/lithic-node/blob/main/CONTRIBUTING.md Execute the project's test suite. ```sh $ yarn run test ``` -------------------------------- ### client.financialAccounts.list Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Lists financial accounts. This method corresponds to the GET /v1/financial_accounts API endpoint. ```APIDOC ## GET /v1/financial_accounts ### Description Lists financial accounts. ### Method GET ### Endpoint /v1/financial_accounts ### Parameters #### Query Parameters - **params** (object) - Optional - An object containing query parameters for listing financial accounts. ### Request Example ```json { "example": "request example for list financial accounts" } ``` ### Response #### Success Response (200) - **FinancialAccountsSinglePage** (object) - A single page of financial accounts. #### Response Example ```json { "example": "response example for list financial accounts" } ``` ``` -------------------------------- ### client.cards.embed Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Retrieves embeddable card information. This method corresponds to the GET /v1/embed/card endpoint. ```APIDOC ## GET /v1/embed/card ### Description Retrieves embeddable card information. ### Method GET ### Endpoint /v1/embed/card ### Parameters #### Query Parameters - **params** (object) - Optional - An object containing query parameters for embeddable card information. ### Response #### Success Response (200) - **string** (string) - A string containing embeddable card information. #### Response Example ```json { "example": "response body for embed card" } ``` ``` -------------------------------- ### checkStatus Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Checks the status of a responder endpoint. This method corresponds to the GET /v1/responder_endpoints API call. ```APIDOC ## GET /v1/responder_endpoints ### Description Checks the status of a responder endpoint. ### Method GET ### Endpoint /v1/responder_endpoints ### Parameters #### Request Body - **params** (object) - Required - An object containing the parameters for checking the responder endpoint status. ### Response #### Success Response (200) - **ResponderEndpointStatus** - The status object for the responder endpoint. ``` -------------------------------- ### Link Local Repository with pnpm Source: https://github.com/lithic-com/lithic-node/blob/main/CONTRIBUTING.md Clone the repository and use `pnpm link` to link it to your local package for development. ```sh # With pnpm $ pnpm link --global $ cd ../my-package $ pnpm link --global lithic ``` -------------------------------- ### client.cards.retrieveSignals Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Retrieves signals for a card. This method corresponds to the GET /v1/cards/{card_token}/signals endpoint. ```APIDOC ## GET /v1/cards/{card_token}/signals ### Description Retrieves signals for a card. ### Method GET ### Endpoint /v1/cards/{card_token}/signals ### Parameters #### Path Parameters - **cardToken** (string) - Required - The unique identifier for the card. ### Response #### Success Response (200) - **SignalsResponse** (object) - The response object containing signals. #### Response Example ```json { "example": "response body for card signals" } ``` ``` -------------------------------- ### client.cards.retrieve Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Retrieves a specific card by its token. This method corresponds to the GET /v1/cards/{card_token} endpoint. ```APIDOC ## GET /v1/cards/{card_token} ### Description Retrieves a specific card by its token. ### Method GET ### Endpoint /v1/cards/{card_token} ### Parameters #### Path Parameters - **cardToken** (string) - Required - The unique identifier for the card. ### Response #### Success Response (200) - **Card** (object) - The retrieved card object. #### Response Example ```json { "example": "response body for retrieved card" } ``` ``` -------------------------------- ### client.transactionMonitoring.queues.create Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Creates a new transaction monitoring queue. Requires queue details in the parameters. ```APIDOC ## POST /v1/transaction_monitoring/queues ### Description Creates a new transaction monitoring queue. ### Method POST ### Endpoint /v1/transaction_monitoring/queues ### Parameters #### Request Body - **params** (object) - Required - Object containing queue configuration details. ``` -------------------------------- ### Retrieve Transaction Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Retrieves a specific transaction by its token. This is useful for getting detailed information about a past transaction. ```APIDOC ## GET /v1/transactions/{transaction_token} ### Description Retrieves a specific transaction using its unique token. ### Method GET ### Endpoint /v1/transactions/{transaction_token} ### Parameters #### Path Parameters - **transactionToken** (string) - Required - The unique identifier for the transaction. ### Response #### Success Response (200) - **transaction** (Transaction) - The retrieved transaction object. ``` -------------------------------- ### client.disputes.initiateEvidenceUpload Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Initiates the upload process for evidence related to a dispute. ```APIDOC ## POST /v1/disputes/{dispute_token}/evidences ### Description Initiates the upload process for evidence related to a dispute. ### Method POST ### Endpoint /v1/disputes/{dispute_token}/evidences ### Parameters #### Path Parameters - **disputeToken** (string) - Required - The token of the dispute to which the evidence will be added. #### Request Body - **params** (object) - Required - An object containing parameters for initiating the evidence upload. ``` -------------------------------- ### client.financialAccounts.retrieve Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Retrieves a financial account by its token. This method corresponds to the GET /v1/financial_accounts/{financial_account_token} API endpoint. ```APIDOC ## GET /v1/financial_accounts/{financial_account_token} ### Description Retrieves a financial account by its token. ### Method GET ### Endpoint /v1/financial_accounts/{financial_account_token} ### Parameters #### Path Parameters - **financialAccountToken** (string) - Required - The token of the financial account to retrieve. ### Request Example ```json { "example": "request example for retrieve financial account" } ``` ### Response #### Success Response (200) - **FinancialAccount** (object) - The retrieved financial account object. #### Response Example ```json { "example": "response example for retrieve financial account" } ``` ``` -------------------------------- ### Create Account Holder Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Creates a new account holder. This is the primary method for onboarding users. ```APIDOC ## POST /v1/account_holders ### Description Creates a new account holder. ### Method POST ### Endpoint /v1/account_holders ### Parameters #### Request Body - **params** (object) - Required - Parameters for creating an account holder. ### Response #### Success Response (200) - **AccountHolderCreateResponse** - The response object containing details of the created account holder. ``` -------------------------------- ### client.cards.financialTransactions.list Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Lists financial transactions for a card. This method corresponds to the GET /v1/cards/{card_token}/financial_transactions endpoint. ```APIDOC ## GET /v1/cards/{card_token}/financial_transactions ### Description Lists financial transactions for a card. ### Method GET ### Endpoint /v1/cards/{card_token}/financial_transactions ### Parameters #### Path Parameters - **cardToken** (string) - Required - The unique identifier for the card. #### Query Parameters - **params** (object) - Optional - An object containing query parameters for filtering transactions. ### Response #### Success Response (200) - **FinancialTransactionsSinglePage** (object) - A paginated list of financial transactions. #### Response Example ```json { "example": "response body for list financial transactions" } ``` ``` -------------------------------- ### Link Local Repository with Yarn Source: https://github.com/lithic-com/lithic-node/blob/main/CONTRIBUTING.md Clone the repository and use `yarn link` to link it to your local package for development. ```sh # Clone $ git clone https://www.github.com/lithic-com/lithic-node $ cd lithic-node # With yarn $ yarn link $ cd ../my-package $ yarn link lithic ``` -------------------------------- ### client.cards.retrieveSpendLimits Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Retrieves spend limits for a card. This method corresponds to the GET /v1/cards/{card_token}/spend_limits endpoint. ```APIDOC ## GET /v1/cards/{card_token}/spend_limits ### Description Retrieves spend limits for a card. ### Method GET ### Endpoint /v1/cards/{card_token}/spend_limits ### Parameters #### Path Parameters - **cardToken** (string) - Required - The unique identifier for the card. ### Response #### Success Response (200) - **CardSpendLimits** (object) - The response object containing card spend limits. #### Response Example ```json { "example": "response body for card spend limits" } ``` ``` -------------------------------- ### client.authRules.v2.backtests.create Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Creates a new backtest for a given auth rule. This allows you to test how a rule would have performed on historical data. ```APIDOC ## POST /v2/auth_rules/{auth_rule_token}/backtests ### Description Creates a new backtest for a specified auth rule. ### Method POST ### Endpoint /v2/auth_rules/{auth_rule_token}/backtests ### Parameters #### Path Parameters - **authRuleToken** (string) - Required - The token of the auth rule to create a backtest for. #### Request Body - **params** (object) - Required - Parameters for creating the backtest. The exact fields depend on the SDK implementation but typically include data for the backtest. ### Response #### Success Response (200) - **BacktestCreateResponse** (object) - Contains information about the created backtest, including its token. ``` -------------------------------- ### Web Provision Card Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Initiates the web provisioning process for a card, returning web provisioning details. ```typescript client.cards.webProvision(cardToken, { ...params }) -> CardWebProvisionResponse ``` -------------------------------- ### client.creditProducts.primeRates.retrieve Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Retrieves prime rates for a given credit product token. ```APIDOC ## GET /v1/credit_products/{credit_product_token}/prime_rates ### Description Retrieves the current prime rates for a specified credit product. ### Method GET ### Endpoint /v1/credit_products/{credit_product_token}/prime_rates ### Parameters #### Path Parameters - **creditProductToken** (string) - Required - The unique identifier for the credit product. #### Query Parameters - **params** (object) - Optional - An object containing parameters for retrieving prime rates. ``` -------------------------------- ### List Case Files Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Lists all files associated with a transaction monitoring case. ```APIDOC ## GET /v1/transaction_monitoring/cases/{case_token}/files ### Description Lists all files associated with a transaction monitoring case. ### Method GET ### Endpoint /v1/transaction_monitoring/cases/{case_token}/files ### Parameters #### Path Parameters - **caseToken** (string) - Required - The unique identifier for the case. #### Query Parameters - **params** (object) - Optional - An object containing query parameters for filtering and pagination. ### Response #### Success Response (200) - **CaseFilesCursorPage** (object) - A paginated list of case files. ``` -------------------------------- ### client.cards.financialTransactions.retrieve Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Retrieves a specific financial transaction for a card. This method corresponds to the GET /v1/cards/{card_token}/financial_transactions/{financial_transaction_token} endpoint. ```APIDOC ## GET /v1/cards/{card_token}/financial_transactions/{financial_transaction_token} ### Description Retrieves a specific financial transaction for a card. ### Method GET ### Endpoint /v1/cards/{card_token}/financial_transactions/{financial_transaction_token} ### Parameters #### Path Parameters - **cardToken** (string) - Required - The unique identifier for the card. - **financialTransactionToken** (string) - Required - The unique identifier for the financial transaction. #### Query Parameters - **params** (object) - Optional - An object containing query parameters. ### Response #### Success Response (200) - **FinancialTransaction** (object) - The retrieved financial transaction object. #### Response Example ```json { "example": "response body for retrieved financial transaction" } ``` ``` -------------------------------- ### client.payments.retrieve Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Retrieves an existing payment by its token. This method sends a GET request to the /v1/payments/{payment_token} endpoint and returns a Payment object. ```APIDOC ## GET /v1/payments/{payment_token} ### Description Retrieves an existing payment by its token. ### Method GET ### Endpoint /v1/payments/{payment_token} ### Parameters #### Path Parameters - **paymentToken** (string) - Required - The unique identifier for the payment. ### Response #### Success Response (200) - **Payment** (object) - The payment object. #### Response Example ```json { "example": "response body for retrieve payment" } ``` ``` -------------------------------- ### client.holds.create Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Creates a new hold for a financial account, with optional parameters. ```APIDOC ## POST /v1/financial_accounts/{financial_account_token}/holds ### Description Creates a new hold associated with a specific financial account. Additional parameters can be provided to customize the hold. ### Method POST ### Endpoint /v1/financial_accounts/{financial_account_token}/holds ### Parameters #### Path Parameters - **financialAccountToken** (string) - Required - The token of the financial account to create the hold for. #### Request Body - **params** (object) - Required - An object containing details and parameters for the hold creation. ``` -------------------------------- ### client.cardPrograms.list Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Retrieves a paginated list of card programs. ```APIDOC ## GET /v1/card_programs ### Description Retrieves a paginated list of card programs. ### Method GET ### Endpoint /v1/card_programs ### Parameters #### Query Parameters - **...params** (object) - Optional - Additional parameters for pagination and filtering. ``` -------------------------------- ### Retrieve Financial Account Credit Configuration Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Fetches the current credit configuration for a financial account. Use this to understand credit limits and related settings. ```typescript client.financialAccounts.creditConfiguration.retrieve(financialAccountToken) -> FinancialAccountCreditConfig ``` -------------------------------- ### client.authRules.v2.backtests.retrieve Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Retrieves the results of a previously created auth rule backtest. ```APIDOC ## GET /v2/auth_rules/{auth_rule_token}/backtests/{auth_rule_backtest_token} ### Description Retrieves the results of a specific auth rule backtest. ### Method GET ### Endpoint /v2/auth_rules/{auth_rule_token}/backtests/{auth_rule_backtest_token} ### Parameters #### Path Parameters - **authRuleBacktestToken** (string) - Required - The token of the auth rule backtest to retrieve. - **authRuleToken** (string) - Required - The token of the associated auth rule. #### Query Parameters - **params** (object) - Optional - Additional parameters for retrieving the backtest results, if any. ### Response #### Success Response (200) - **BacktestResults** (object) - Contains the detailed results of the backtest. ``` -------------------------------- ### client.networkPrograms.list Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Lists network programs, with support for filtering via parameters. ```APIDOC ## GET /v1/network_programs ### Description Retrieves a list of network programs. This method supports filtering and pagination through query parameters. ### Method GET ### Endpoint /v1/network_programs ### Parameters #### Query Parameters - **params** (object) - Optional - An object containing parameters for filtering and pagination. ``` -------------------------------- ### Simulate Credit Authorization Advice Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Simulates a credit authorization advice message. This is used for follow-up information on credit authorizations. ```APIDOC ## POST /v1/simulate/credit_authorization_advice ### Description Simulates a credit authorization advice message. ### Method POST ### Endpoint /v1/simulate/credit_authorization_advice ### Parameters #### Request Body - **...params** (object) - Required - Details of the simulated credit authorization advice. ``` -------------------------------- ### client.payments.simulateReturn Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Simulates the return of a payment. This method sends a POST request to the /v1/simulate/payments/return endpoint and returns a PaymentSimulateReturnResponse. ```APIDOC ## POST /v1/simulate/payments/return ### Description Simulates the return of a payment. ### Method POST ### Endpoint /v1/simulate/payments/return ### Parameters #### Request Body - **params** (object) - Required - An object containing simulation return details. ### Response #### Success Response (200) - **PaymentSimulateReturnResponse** (object) - The response object for a simulated payment return. #### Response Example ```json { "example": "response body for simulate payment return" } ``` ``` -------------------------------- ### Handle Lithic API Errors Source: https://github.com/lithic-com/lithic-node/blob/main/README.md Implement error handling for API-related issues, such as connection problems or non-success status codes. This example demonstrates catching specific Lithic API errors and accessing their properties like status, name, and error messages. ```typescript const card = await client.cards.create({ type: 'MERCHANT_LOCKED' }).catch(async (err) => { if (err instanceof Lithic.APIError) { console.log(err.status); // 400 console.log(err.name); // BadRequestError console.log(err.error?.message); // Invalid parameter(s): type console.log(err.error?.debugging_request_id); // 94d5e915-xxxx-4cee-a4f5-2xd6ebd279ac console.log(err.headers); // {server: 'nginx', ...} } else { throw err; } }); ``` -------------------------------- ### Simulate Account Holder Enrollment Document Review Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Simulates the document review process for account holder enrollment. ```APIDOC ## POST /v1/simulate/account_holders/enrollment_document_review ### Description Simulates the document review process for account holder enrollment. ### Method POST ### Endpoint /v1/simulate/account_holders/enrollment_document_review ### Parameters #### Request Body - **params** (object) - Required - Parameters for the simulation. ### Response #### Success Response (200) - **Document** - The simulated document review result. ``` -------------------------------- ### Simulate Tokenization Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Simulates a tokenization event, useful for testing and development. ```APIDOC ## POST /v1/simulate/tokenizations ### Description Simulates a tokenization event. ### Method POST ### Endpoint /v1/simulate/tokenizations ### Parameters #### Request Body - **account_token** (string) - Required - The token of the account to simulate the tokenization for. - **card_token** (string) - Required - The token of the card to simulate the tokenization for. - **device_id** (string) - Optional - The ID of the device used for the tokenization. - **digital_wallet_type** (string) - Optional - The type of digital wallet used (e.g., APPLE_PAY, GOOGLE_PAY). - **exp_month** (integer) - Optional - The expiration month of the card. - **exp_year** (integer) - Optional - The expiration year of the card. - **token_requester_id** (string) - Optional - The ID of the token requester. ### Response #### Success Response (200) - **tokenization** (object) - The simulated tokenization details. ``` -------------------------------- ### Simulate Transaction Authorization Advice Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Simulates an authorization advice message for a transaction. This is used to send follow-up information after an initial authorization. ```APIDOC ## POST /v1/simulate/authorization_advice ### Description Simulates an authorization advice message for a transaction. ### Method POST ### Endpoint /v1/simulate/authorization_advice ### Parameters #### Request Body - **...params** (object) - Required - Details of the simulated authorization advice. ``` -------------------------------- ### client.networkPrograms.retrieve Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Retrieves a network program by its token. ```APIDOC ## GET /v1/network_programs/{network_program_token} ### Description Retrieves a specific network program using its unique token. ### Method GET ### Endpoint /v1/network_programs/{network_program_token} ### Parameters #### Path Parameters - **networkProgramToken** (string) - Required - The token of the network program to retrieve. ``` -------------------------------- ### list Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Lists all management operations, with support for cursor-based pagination. ```APIDOC ## GET /v1/management_operations ### Description Lists all management operations. ### Method GET ### Endpoint /v1/management_operations ### Parameters #### Query Parameters - **params** (object) - Required - An object containing query parameters for filtering and pagination. ``` -------------------------------- ### client.financialAccounts.create Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Creates a new financial account. This method corresponds to the POST /v1/financial_accounts API endpoint. ```APIDOC ## POST /v1/financial_accounts ### Description Creates a new financial account. ### Method POST ### Endpoint /v1/financial_accounts ### Parameters #### Request Body - **params** (object) - Required - An object containing the parameters for creating a financial account. ### Request Example ```json { "example": "request body for create financial account" } ``` ### Response #### Success Response (200) - **FinancialAccount** (object) - The created financial account object. #### Response Example ```json { "example": "response body for create financial account" } ``` ``` -------------------------------- ### Retrieve Loan Tape Configuration Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Retrieves the loan tape configuration for a specific financial account. ```APIDOC ## GET /v1/financial_accounts/{financial_account_token}/loan_tape_configuration ### Description Retrieves the loan tape configuration for a specific financial account. ### Method GET ### Endpoint /v1/financial_accounts/{financial_account_token}/loan_tape_configuration ### Parameters #### Path Parameters - **financial_account_token** (string) - Required - The unique identifier for the financial account. ### Response #### Success Response (200) - **loan_tape_configuration** (LoanTapeConfiguration) - The loan tape configuration details. ``` -------------------------------- ### Publish NPM Package Manually Source: https://github.com/lithic-com/lithic-node/blob/main/CONTRIBUTING.md Manually release a package by running the `bin/publish-npm` script with an `NPM_TOKEN` environment variable set. ```sh $ bin/publish-npm ``` -------------------------------- ### Replace APIClient with Lithic Client Source: https://github.com/lithic-com/lithic-node/blob/main/MIGRATION.md Illustrates the change from importing the deprecated `APIClient` to importing the main `Lithic` client class. ```typescript // Before import { APIClient } from 'lithic/core'; // After import { Lithic } from 'lithic'; ``` -------------------------------- ### client.disputes.uploadEvidence Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Uploads a file as evidence for a dispute. This is an asynchronous operation. ```APIDOC ## POST /v1/disputes/{dispute_token}/evidences ### Description Uploads a file as evidence for a dispute. ### Method POST ### Endpoint /v1/disputes/{dispute_token}/evidences ### Parameters #### Path Parameters - **disputeToken** (string) - Required - The token of the dispute to which the evidence will be added. #### Request Body - **file** (File) - Required - The file to upload as evidence. - **options** (object) - Optional - Additional options for the upload. ``` -------------------------------- ### Create Case File Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Uploads a file associated with a transaction monitoring case. ```APIDOC ## POST /v1/transaction_monitoring/cases/{case_token}/files ### Description Uploads a file associated with a transaction monitoring case. ### Method POST ### Endpoint /v1/transaction_monitoring/cases/{case_token}/files ### Parameters #### Path Parameters - **caseToken** (string) - Required - The unique identifier for the case. #### Request Body - **params** (object) - Required - An object containing the file details and content. ### Response #### Success Response (200) - **CaseFile** (object) - The uploaded file details. ``` -------------------------------- ### Correct Runtime Imports from 'lithic/src' Source: https://github.com/lithic-com/lithic-node/blob/main/MIGRATION.md Replaces imports from the internal 'lithic/src' directory with imports from the root 'lithic' package for runtime stability. ```typescript // Before import Lithic from 'lithic/src'; // After import Lithic from 'lithic'; ``` -------------------------------- ### client.payments.simulateAction Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Simulates an action on a payment. This method sends a POST request to the /v1/simulate/payments/{payment_token}/action endpoint and returns a PaymentSimulateActionResponse. ```APIDOC ## POST /v1/simulate/payments/{payment_token}/action ### Description Simulates an action on a payment. ### Method POST ### Endpoint /v1/simulate/payments/{payment_token}/action ### Parameters #### Path Parameters - **paymentToken** (string) - Required - The unique identifier for the payment. #### Request Body - **params** (object) - Required - An object containing simulation action details. ### Response #### Success Response (200) - **PaymentSimulateActionResponse** (object) - The response object for a simulated payment action. #### Response Example ```json { "example": "response body for simulate payment action" } ``` ``` -------------------------------- ### client.threeDS.authentication.simulateOtpEntry Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Simulates an OTP entry for a ThreeDS authentication. ```APIDOC ## POST /v1/three_ds_decisioning/simulate/enter_otp ### Description Simulates an OTP entry for a ThreeDS authentication. ### Method POST ### Endpoint /v1/three_ds_decisioning/simulate/enter_otp ### Parameters #### Request Body - **params** (object) - Required - Parameters for the OTP entry simulation. The exact fields depend on the simulation context. ``` -------------------------------- ### client.financialAccounts.loanTapes.list Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Lists all loan tapes for a given financial account, with optional filtering and pagination. ```APIDOC ## GET /v1/financial_accounts/{financial_account_token}/loan_tapes ### Description Lists all loan tapes associated with a financial account. Supports pagination and filtering through query parameters. ### Method GET ### Endpoint /v1/financial_accounts/{financial_account_token}/loan_tapes ### Parameters #### Path Parameters - **financial_account_token** (string) - Required - The token of the financial account. #### Query Parameters - **...params** (object) - Optional - Parameters for filtering and pagination. ### Response #### Success Response (200) - **LoanTapesCursorPage** (object) - A paginated list of loan tapes. ``` -------------------------------- ### Configure Custom Fetch Options Source: https://github.com/lithic-com/lithic-node/blob/main/README.md Provide custom fetch options during client instantiation to modify the behavior of all requests made by the client. ```typescript import Lithic from 'lithic'; const client = new Lithic({ fetchOptions: { // `RequestInit` options }, }); ``` -------------------------------- ### Create Micro Deposit Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Initiates the micro-deposit process for an external bank account. This is used to verify account ownership by depositing small amounts. ```APIDOC ## POST /v1/external_bank_accounts/{external_bank_account_token}/micro_deposits ### Description Initiates the micro-deposit process for an external bank account. ### Method POST ### Endpoint /v1/external_bank_accounts/{external_bank_account_token}/micro_deposits ### Parameters #### Path Parameters - **external_bank_account_token** (string) - Required - The token of the external bank account for which to initiate micro-deposits. #### Request Body - **webhook_url** (string) - Optional - The URL to send webhook events to. ### Response #### Success Response (200 OK) - **token** (string) - The unique identifier for the micro-deposit entry. - **external_account_token** (string) - The token of the associated external bank account. - **status** (string) - The status of the micro-deposit process ('pending', 'succeeded', 'failed'). - **created_at** (string) - The timestamp when the micro-deposit process was initiated. ### Response Example ```json { "token": "micro_deposit_xyz789", "external_account_token": "ebank_a1b2c3d4e5f6", "status": "pending", "created_at": "2023-01-01T12:40:00Z" } ``` ``` -------------------------------- ### client.transactionMonitoring.queues.list Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Lists all transaction monitoring queues with optional filtering parameters. ```APIDOC ## GET /v1/transaction_monitoring/queues ### Description Lists all transaction monitoring queues. ### Method GET ### Endpoint /v1/transaction_monitoring/queues ### Parameters #### Query Parameters - **params** (object) - Optional - Object containing parameters for filtering and pagination. ``` -------------------------------- ### Create Event Subscription Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Creates a new event subscription. ```APIDOC ## POST /v1/event_subscriptions ### Description Creates a new event subscription. ### Method POST ### Endpoint /v1/event_subscriptions ### Parameters #### Request Body - **params** (object) - Required - Parameters for creating the event subscription. ### Response #### Success Response (200) - Returns an EventSubscription object. #### Response Example { "example": "EventSubscription object" } ``` -------------------------------- ### client.payments.simulateReceipt Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Simulates a payment receipt. This method sends a POST request to the /v1/simulate/payments/receipt endpoint and returns a PaymentSimulateReceiptResponse. ```APIDOC ## POST /v1/simulate/payments/receipt ### Description Simulates a payment receipt. ### Method POST ### Endpoint /v1/simulate/payments/receipt ### Parameters #### Request Body - **params** (object) - Required - An object containing simulation receipt details. ### Response #### Success Response (200) - **PaymentSimulateReceiptResponse** (object) - The response object for a simulated payment receipt. #### Response Example ```json { "example": "response body for simulate payment receipt" } ``` ``` -------------------------------- ### Migrating httpAgent to fetchOptions for Proxy Support Source: https://github.com/lithic-com/lithic-node/blob/main/MIGRATION.md The `httpAgent` client option has been removed. Use the platform-specific `fetchOptions` property with `undici.ProxyAgent` for proxy support. ```typescript import Lithic from 'lithic'; import http from 'http'; import { HttpsProxyAgent } from 'https-proxy-agent'; // Configure the default for all requests: const client = new Lithic({ httpAgent: new HttpsProxyAgent(process.env.PROXY_URL), }); ``` ```typescript import Lithic from 'lithic'; import * as undici from 'undici'; const proxyAgent = new undici.ProxyAgent(process.env.PROXY_URL); const client = new Lithic({ fetchOptions: { dispatcher: proxyAgent, }, }); ``` -------------------------------- ### Simplify Manual Pagination Source: https://github.com/lithic-com/lithic-node/blob/main/MIGRATION.md Shows the updated method for retrieving pagination options, simplifying manual handling of page requests. ```javascript // Before page.nextPageParams(); page.nextPageInfo(); // Required manually handling { url } | { params } type // After page.nextPageRequestOptions(); ``` -------------------------------- ### create Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Creates a new responder endpoint. This method corresponds to the POST /v1/responder_endpoints API call. ```APIDOC ## POST /v1/responder_endpoints ### Description Creates a new responder endpoint. ### Method POST ### Endpoint /v1/responder_endpoints ### Parameters #### Request Body - **params** (object) - Required - An object containing the parameters for creating the responder endpoint. ### Response #### Success Response (200) - **ResponderEndpointCreateResponse** - The response object upon successful creation of the responder endpoint. ``` -------------------------------- ### Pass Custom Fetch Client to Lithic Source: https://github.com/lithic-com/lithic-node/blob/main/README.md Instantiate the Lithic client with a specific fetch function by passing it in the constructor options. ```typescript import Lithic from 'lithic'; import fetch from 'my-fetch'; const client = new Lithic({ fetch }); ``` -------------------------------- ### Auto-pagination Source: https://github.com/lithic-com/lithic-node/blob/main/README.md Iterate through paginated API results seamlessly using `for await...of` or manually paginate through pages. ```APIDOC ## Auto-pagination ### Description List methods in the Lithic API are paginated. You can use the `for await … of` syntax to iterate through items across all pages, or request a single page at a time. ### Iterating Through All Pages ```ts async function fetchAllNonPCICards(params) { const allNonPCICards = []; // Automatically fetches more pages as needed. for await (const nonPCICard of client.cards.list()) { allNonPCICards.push(nonPCICard); } return allNonPCICards; } ``` ### Requesting a Single Page ```ts let page = await client.cards.list(); for (const nonPCICard of page.data) { console.log(nonPCICard); } // Convenience methods are provided for manually paginating: while (page.hasNextPage()) { page = await page.getNextPage(); // ... } ``` ``` -------------------------------- ### client.balances.list Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Retrieves a list of account balances. Provides an overview of financial balances. ```APIDOC ## GET /v1/balances ### Description Retrieves a list of account balances. ### Method GET ### Endpoint /v1/balances ### Parameters #### Query Parameters - **params** (object) - Optional - An object containing query parameters for filtering. ``` -------------------------------- ### client.threeDS.authentication.simulate Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Simulates a ThreeDS authentication response. ```APIDOC ## POST /v1/three_ds_authentication/simulate ### Description Simulates a ThreeDS authentication response. ### Method POST ### Endpoint /v1/three_ds_authentication/simulate ### Parameters #### Request Body - **params** (object) - Required - Parameters for the simulation. The exact fields depend on the simulation context. ``` -------------------------------- ### Provision Card Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Initiates the provisioning process for a card, returning provisioning details. ```typescript client.cards.provision(cardToken, { ...params }) -> CardProvisionResponse ``` -------------------------------- ### create Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Creates a new management operation. This is typically used for initiating actions like card issuance or account funding. ```APIDOC ## POST /v1/management_operations ### Description Creates a new management operation. ### Method POST ### Endpoint /v1/management_operations ### Parameters #### Request Body - **params** (object) - Required - An object containing the parameters for the management operation. ``` -------------------------------- ### client.cards.webProvision Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Provisions a card for web usage. This method corresponds to the POST /v1/cards/{card_token}/web_provision endpoint. ```APIDOC ## POST /v1/cards/{card_token}/web_provision ### Description Provisions a card for web usage. ### Method POST ### Endpoint /v1/cards/{card_token}/web_provision ### Parameters #### Path Parameters - **cardToken** (string) - Required - The unique identifier for the card. #### Request Body - **params** (object) - Required - An object containing the parameters for web provisioning. ### Request Example ```json { "example": "request body for web provision card" } ``` ### Response #### Success Response (200) - **CardWebProvisionResponse** (object) - The response object for web card provisioning. #### Response Example ```json { "example": "response body for web provision card" } ``` ``` -------------------------------- ### list Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Lists all funding events, with support for cursor-based pagination. ```APIDOC ## GET /v1/funding_events ### Description Lists all funding events. ### Method GET ### Endpoint /v1/funding_events ### Parameters #### Query Parameters - **params** (object) - Required - An object containing query parameters for filtering and pagination. ``` -------------------------------- ### client.payments.simulateRelease Source: https://github.com/lithic-com/lithic-node/blob/main/api.md Simulates the release of a payment. This method sends a POST request to the /v1/simulate/payments/release endpoint and returns a PaymentSimulateReleaseResponse. ```APIDOC ## POST /v1/simulate/payments/release ### Description Simulates the release of a payment. ### Method POST ### Endpoint /v1/simulate/payments/release ### Parameters #### Request Body - **params** (object) - Required - An object containing simulation release details. ### Response #### Success Response (200) - **PaymentSimulateReleaseResponse** (object) - The response object for a simulated payment release. #### Response Example ```json { "example": "response body for simulate payment release" } ``` ```