### Install method-node Source: https://github.com/methodfi/method-node/blob/master/README.md Install the method-node library using npm. This is the first step to integrate with the Method API. ```bash npm install --save method-node ``` -------------------------------- ### List All Account Subscriptions Source: https://github.com/methodfi/method-node/blob/master/README.md Retrieves a list of all subscriptions associated with a specific account. No specific setup is required beyond having an account ID. ```javascript const response = await method .accounts('acc_yVf3mkzbhz9tj') .subscriptions .list(); ``` -------------------------------- ### List Entities Source: https://github.com/methodfi/method-node/blob/master/README.md List all entities associated with your account. This can be used to get an overview of your managed entities. ```javascript const entities = await method.entities.list(); ``` -------------------------------- ### Update a Reversal Source: https://github.com/methodfi/method-node/blob/master/README.md Updates a specific reversal for a payment, for example, to change its status. ```javascript const reversal = await method .payments('pmt_rPrDPEwyCVUcm') .reversals .update('rvs_eaBAUJtetgMdR', { status: 'pending' }); ``` -------------------------------- ### Initialize Method Client Source: https://github.com/methodfi/method-node/blob/master/README.md Initialize the Method client with your API key and environment. Ensure you replace '' with your actual key. ```javascript import { Method, Environments } from 'method-node'; const method = new Method({ apiKey: '', env: Environments.dev, }); ``` -------------------------------- ### Client Initialization Source: https://context7.com/methodfi/method-node/llms.txt Instantiate a Method client with an API key and target environment. Optionally configure request/response hooks and Axios retry behavior. ```APIDOC ## Client Initialization — `new Method(opts)` Instantiate a single `Method` client with an API key and target environment. Optionally attach request/response lifecycle hooks and configure Axios retry behaviour. ```typescript import { Method, Environments } from 'method-node'; const method = new Method({ apiKey: process.env.METHOD_API_KEY!, env: Environments.dev, // 'dev' | 'sandbox' | 'production' onRequest: (event) => { console.log(`→ ${event.method} ${event.path}`); }, onResponse: (event) => { console.log(`← ${event.status} in ${event.request_end_time - event.request_start_time}ms`); }, axiosRetryConfig: { retries: 3, retryDelay: (count) => count * 500, }, }); // Verify connectivity const ping = await method.ping(); // { success: true, data: null, message: 'pong' } ``` ``` -------------------------------- ### List Account Products Source: https://github.com/methodfi/method-node/blob/master/README.md Lists all products available for a given account. ```APIDOC ## List all Products ### Description Retrieves an overview of all products (capabilities) an account has access to, including their status. Some products may have restricted access. ### Method `method.accounts(accountId).products.list()` ### Parameters #### Path Parameters - **accountId** (string) - Required - The ID of the account to list products for. ### Request Example ```javascript const response = await method .accounts('acc_yVf3mkzbhz9tj') .products .list(); ``` ``` -------------------------------- ### Initialize Method Client Source: https://context7.com/methodfi/method-node/llms.txt Instantiate the Method client with an API key and target environment. You can also configure request/response hooks and Axios retry behavior. ```typescript import { Method, Environments } from 'method-node'; const method = new Method({ apiKey: process.env.METHOD_API_KEY!, env: Environments.dev, // 'dev' | 'sandbox' | 'production' onRequest: (event) => { console.log(`→ ${event.method} ${event.path}`); }, onResponse: (event) => { console.log(`← ${event.status} in ${event.request_end_time - event.request_start_time}ms`); }, axiosRetryConfig: { retries: 3, retryDelay: (count) => count * 500, }, }); // Verify connectivity const ping = await method.ping(); // { success: true, data: null, message: 'pong' } ``` -------------------------------- ### List all Products Source: https://github.com/methodfi/method-node/blob/master/README.md Lists all products available for an entity. ```APIDOC ## List all Products ### Description Lists all products available for an entity. Access to most products requires the entity to be active. ### Method GET ### Endpoint /v1/entities/{entity_id}/products ### Parameters #### Path Parameters - **entity_id** (string) - Required - The ID of the entity. ### Response #### Success Response (200) - **products** (array) - A list of available products. ``` -------------------------------- ### List all Products for an Entity Source: https://github.com/methodfi/method-node/blob/master/README.md Lists all available products for an entity. Requires the entity ID. Access to most products requires an active entity. ```javascript const response = await method .entities('ent_TYHMaRJUUeJ7U') .products .list(); ``` -------------------------------- ### Create Balance Source: https://github.com/methodfi/method-node/blob/master/README.md Creates a balance entry for a given account. ```APIDOC ## Create a Balance ### Description Requests the creation of a balance entry for a specific account to retrieve its real-time balance. ### Method `method.accounts(accountId).balances.create()` ### Parameters #### Path Parameters - **accountId** (string) - Required - The ID of the account for which to create a balance entry. ### Request Example ```javascript const response = await method .accounts('acc_yVf3mkzbhz9tj') .balances .create(); ``` ``` -------------------------------- ### Create a Subscription Source: https://github.com/methodfi/method-node/blob/master/README.md Creates a new subscription for an entity for a given product. ```APIDOC ## Create a Subscription ### Description Creates a new subscription for an entity for a given product. Subscriptions provide continuous updates via Webhooks. ### Method POST ### Endpoint /v1/entities/{entity_id}/subscriptions ### Parameters #### Path Parameters - **entity_id** (string) - Required - The ID of the entity. #### Query Parameters - **product_id** (string) - Required - The ID of the product for which to create a subscription (e.g., 'credit_score'). ### Response #### Success Response (200) - **subscription** (object) - Details of the created subscription. ``` -------------------------------- ### List Account Products Source: https://github.com/methodfi/method-node/blob/master/README.md Lists all products available for an account. Requires account ID. Some products may have restricted access. ```javascript const response = await method .accounts('acc_yVf3mkzbhz9tj') .products .list(); ``` -------------------------------- ### List Balances Source: https://github.com/methodfi/method-node/blob/master/README.md Lists all balance entries for a given account. ```APIDOC ## List all Balances ### Description Retrieves a list of all balance entries associated with a specific account. ### Method `method.accounts(accountId).balances.list()` ### Parameters #### Path Parameters - **accountId** (string) - Required - The ID of the account to list balances for. ### Request Example ```javascript const response = await method .accounts('acc_yVf3mkzbhz9tj') .balances .list(); ``` ``` -------------------------------- ### Initiate, Retrieve, and List Entity Connect Requests Source: https://context7.com/methodfi/method-node/llms.txt Use these methods to manage the process of discovering and linking an entity's liability accounts. Initiate a new request, retrieve a specific result, or list all connect records for an entity. ```typescript const connect = await method.entities('ent_qKNBB68bfHGNA').connect.create( { products: ['balance', 'update', 'card_brand'], subscriptions: ['update', 'transaction'], }, { expand: ['accounts', 'accounts.balance'] }, // expand on response { idempotency_key: 'unique-key-123' }, ); // connect.status => 'pending' | 'in_progress' | 'completed' | 'failed' // connect.accounts => ['acc_xxx', 'acc_yyy', ...] ``` ```typescript const result = await method.entities('ent_qKNBB68bfHGNA').connect.retrieve( 'cxn_4ewMmBbjYDMR4', { expand: ['accounts'] }, ); ``` ```typescript const connects = await method.entities('ent_qKNBB68bfHGNA').connect.list({ page_limit: 10, }); ``` -------------------------------- ### List Account Products Source: https://context7.com/methodfi/method-node/llms.txt Retrieves a list of available products for a specific account, indicating their status and subcribability. ```typescript const products = await method.accounts('acc_yVf3mkzbhz9tj').products.list(); ``` -------------------------------- ### List Webhooks Source: https://github.com/methodfi/method-node/blob/master/README.md Retrieves a list of all configured webhooks. ```APIDOC ## List Webhooks ### Description Retrieves a list of all configured webhooks. ### Method ```javascript await method.webhooks.list() ``` ``` -------------------------------- ### Create a Subscription Source: https://github.com/methodfi/method-node/blob/master/README.md Creates a new subscription for a given account. Subscriptions provide continuous updates via Webhooks. ```APIDOC ## Create a Subscription ### Description Creates a new subscription for a given account. Subscriptions are Products that can provide continuous updates via Webhooks. ### Method ```javascript method.accounts('acc_yVf3mkzbhzbhz9tj').subscriptions.create('update') ``` ### Parameters #### Path Parameters - **accountId** (string) - Required - The ID of the account. - **subscriptionType** (string) - Required - The type of subscription to create (e.g., 'update'). ### Request Example ```javascript const response = await method.accounts('acc_yVf3mkzbhz9tj').subscriptions.create('update'); ``` ### Response #### Success Response (200) - **subscription** (object) - Details of the created subscription. ``` -------------------------------- ### List Webhooks Source: https://github.com/methodfi/method-node/blob/master/README.md Retrieves a list of all configured webhooks. ```javascript const webhooks = await method.webhooks.list(); ``` -------------------------------- ### Create Verification Session Source: https://github.com/methodfi/method-node/blob/master/README.md Initiates a new verification session for an account. ```APIDOC ## Create Verification Session ### Description Initiates a new verification session for an account. This is required to enable products for ACH or Liability accounts. ### Method ```javascript method.accounts('acc_b9q2XVAnNFbp3').verificationSessions.create({ type: '' }) ``` ### Parameters #### Path Parameters - **accountId** (string) - Required - The ID of the account. #### Request Body - **type** (string) - Required - The type of verification session to create (e.g., 'micro_deposits', 'plaid', 'teller', 'mx', 'standard', 'pre_auth'). ### Request Example ```javascript const verification = await method.accounts('acc_b9q2XVAnNFbp3').verificationSessions.create({ type: '' }); ``` ### Response #### Success Response (200) - **verificationSession** (object) - Details of the created verification session. ``` -------------------------------- ### Simulate API Source: https://context7.com/methodfi/method-node/llms.txt The Simulate namespace is available exclusively in the `dev` environment to trigger state transitions and test event-driven flows without waiting for real-world timing. ```APIDOC ## Simulate — `method.simulate` The Simulate namespace is available exclusively in the `dev` environment to trigger state transitions and test event-driven flows without waiting for real-world timing. ```typescript // Advance a payment through its lifecycle await method.simulate.payments.update('pmt_rPrDPEwyCVUcm', { status: 'processing' }); await method.simulate.payments.update('pmt_rPrDPEwyCVUcm', { status: 'sent' }); await method.simulate.payments.update('pmt_rPrDPEwyCVUcm', { status: 'settled' }); // Simulate a failed payment with an error code await method.simulate.payments.update('pmt_rPrDPEwyCVUcm', { status: 'failed', error_code: 10001, }); // Simulate a transaction notification for a credit card account const txn = await method.simulate.accounts('acc_r6JUYN67HhCEM').transactions.create(); // Simulate a credit score update for an entity await method.simulate.entities('ent_au22b1fbFJbp8').creditScores.create(); // Simulate a Connect completion await method.simulate.entities('ent_au22b1fbFJbp8').connect.create(); // Simulate an attribute update await method.simulate.entities('ent_au22b1fbFJbp8').attributes.create(); ``` ``` -------------------------------- ### Create KBA Verification Source: https://github.com/methodfi/method-node/blob/master/README.md Creates a Knowledge-Based Authentication (KBA) verification session for an entity. ```APIDOC ## Create KBA Verification ### Description Creates a Knowledge-Based Authentication (KBA) verification session for an entity. ### Method `method.entities(entityId).verificationSessions.create` ### Parameters #### Path Parameters - **entityId** (string) - Required - The unique identifier of the entity. #### Request Body - **type** (string) - Required - Must be 'identity'. - **method** (string) - Required - Must be 'kba'. - **kba** (object) - Required - An empty object, as KBA details are handled externally. ### Request Example ```javascript const response = await method.entities("ent_hy3xhPDfWDVxi").verificationSessions.create({ type: "identity", method: "kba", kba: {}, }); ``` ``` -------------------------------- ### Create Connect for Entity Source: https://github.com/methodfi/method-node/blob/master/README.md Initiate a connect process for a given entity to link their liability accounts. This is part of the account aggregation flow. ```javascript const entity = await method .entities("ent_qKNBB68bfHGNA") .connect .create(); ``` -------------------------------- ### Retrieve a Product for an Entity Source: https://github.com/methodfi/method-node/blob/master/README.md Retrieves details for a specific product of an entity. Requires the entity ID and product ID. ```javascript const response = await method .entities("ent_TYHMaRJUUeJ7U") .products .retrieve("prd_jPRDcQPMk43Ek"); ``` -------------------------------- ### Create Account Balance Request Source: https://context7.com/methodfi/method-node/llms.txt Initiate a request to pull real-time balance information from an account's financial institution. The request status will be 'pending', 'completed', or 'failed'. ```typescript const balanceReq = await method.accounts('acc_yVf3mkzbhz9tj').balances.create(); // balanceReq.status => 'pending' | 'completed' | 'failed' ``` -------------------------------- ### Create Account Subscription Source: https://github.com/methodfi/method-node/blob/master/README.md Use this to create a new subscription for an account. Ensure the subscription type is valid. ```javascript const response = await method .accounts('acc_yVf3mkzbhz9tj') .subscriptions .create('update'); ``` -------------------------------- ### Create Webhook Source: https://github.com/methodfi/method-node/blob/master/README.md Creates a new webhook to receive event notifications. ```APIDOC ## Create Webhook ### Description Creates a new webhook to receive event notifications. ### Method ```javascript await method.webhooks.create(data) ``` ### Parameters #### Request Body - **data** (object) - Required - An object containing webhook configuration details. - **type** (string) - Required - The type of event to receive notifications for (e.g., 'payment.update'). - **url** (string) - Required - The URL to send webhook notifications to. - **auth_token** (string) - Optional - An authentication token for the webhook. - **hmac_secret** (string) - Optional - A secret key for HMAC signature verification. ``` -------------------------------- ### Retrieve a Product Source: https://github.com/methodfi/method-node/blob/master/README.md Retrieves details of a specific product for an entity. ```APIDOC ## Retrieve a Product ### Description Retrieves details of a specific product for an entity. ### Method GET ### Endpoint /v1/entities/{entity_id}/products/{product_id} ### Parameters #### Path Parameters - **entity_id** (string) - Required - The ID of the entity. - **product_id** (string) - Required - The ID of the product to retrieve. ### Response #### Success Response (200) - **product** (object) - Details of the retrieved product. ``` -------------------------------- ### Create KBA Verification Session Source: https://github.com/methodfi/method-node/blob/master/README.md Create a Knowledge-Based Authentication (KBA) verification session for an entity. This is used for identity verification through questions. ```javascript const response = await method .entities("ent_hy3xhPDfWDVxi") .verificationSessions .create({ type: "identity", method: "kba", kba: {}, }); ``` -------------------------------- ### Retrieve Account Product Source: https://github.com/methodfi/method-node/blob/master/README.md Retrieves details for a specific product of a given account. ```APIDOC ## Retrieve a Product ### Description Retrieves detailed information for a specific product associated with a given account. ### Method `method.accounts(accountId).products.retrieve(productId)` ### Parameters #### Path Parameters - **accountId** (string) - Required - The ID of the account. - **productId** (string) - Required - The ID of the product to retrieve. ### Request Example ```javascript const response = await method .accounts("acc_yVf3mkzbhz9tj") .products .retrieve("prd_FQFHqVNiCRb7J"); ``` ``` -------------------------------- ### Retrieve Account Product Source: https://context7.com/methodfi/method-node/llms.txt Retrieves details for a specific product associated with an account. ```typescript const product = await method.accounts('acc_yVf3mkzbhz9tj').products.retrieve('prd_FQFHqVNiCRb7J'); ``` -------------------------------- ### Create Account Subscription Source: https://context7.com/methodfi/method-node/llms.txt Subscribes an account to receive continuous updates via webhook. Specify the type of updates to enroll in. ```typescript const sub = await method.accounts('acc_yVf3mkzbhz9tj').subscriptions.create({ enroll: 'transaction' }); ``` -------------------------------- ### Create Payment Source: https://github.com/methodfi/method-node/blob/master/README.md Initiates a payment, transferring funds from a source account to a destination. ```APIDOC ## Create Payment ### Description Initiates a payment, transferring funds from a source checking or savings bank account to a destination credit card, auto loan, mortgage, student loan, and more. Payments are processed electronically and typically take 2-3 business days. ### Method ```javascript method.payments.create({ amount: 5000, source: 'acc_JMJZT6r7iHi8e', destination: 'acc_AXthnzpBnxxWP', description: 'Loan Pmt', }) ``` ### Parameters #### Request Body - **amount** (integer) - Required - The amount to transfer in the smallest currency unit (e.g., cents). - **source** (string) - Required - The ID of the source account. - **destination** (string) - Required - The ID of the destination account. - **description** (string) - Optional - A description for the payment. ### Request Example ```javascript const payment = await method.payments.create({ amount: 5000, source: 'acc_JMJZT6r7iHi8e', destination: 'acc_AXthnzpBnxxWP', description: 'Loan Pmt', }); ``` ### Response #### Success Response (200) - **payment** (object) - Details of the created payment. ``` -------------------------------- ### Simulate Transaction Creation Source: https://github.com/methodfi/method-node/blob/master/README.md Simulates the creation of a transaction for a specific account. This is only available in the development environment. ```javascript const transaction = await method .simulate .accounts('acc_r6JUYN67HhCEM') .transactions .create(); ``` -------------------------------- ### Create Balance Source: https://github.com/methodfi/method-node/blob/master/README.md Creates a balance record for an account. Requires account ID. ```javascript const response = await method .accounts('acc_yVf3mkzbhz9tj') .balances .create(); ``` -------------------------------- ### Generate and Download Reports Source: https://context7.com/methodfi/method-node/llms.txt Create CSV snapshots of financial data for reconciliation. Reports are generated asynchronously; poll the status or listen for 'report.create' webhooks. Download the CSV data once the report is completed. ```typescript import { ReportTypes, ReportStatuses } from 'method-node'; // Create a report (async — poll status or listen for 'report.create' webhook) const report = await method.reports.create({ type: ReportTypes.payments_created_current, // 'payments.created.current' }); // report.status => 'processing' | 'completed' ``` ```typescript // Poll until complete let result = await method.reports.retrieve('rpt_cj2mkA3hFyHT5'); while (result.status !== ReportStatuses.completed) { await new Promise(r => setTimeout(r, 2000)); result = await method.reports.retrieve('rpt_cj2mkA3hFyHT5'); } ``` ```typescript // Download CSV data const csv = await method.reports.download('rpt_cj2mkA3hFyHT5'); // csv => 'id,amount,source,destination,status,created_at\n...' ``` -------------------------------- ### Simulate Create Transaction Source: https://github.com/methodfi/method-node/blob/master/README.md Simulates the creation of a transaction for a given account. This is only available in the development environment. ```APIDOC ## Create a Transaction ### Description Simulates the creation of a transaction for a given account. This is only available in the development environment. ### Method ```javascript await method.simulate.accounts(accountId).transactions.create() ``` ### Parameters #### Path Parameters - **accountId** (string) - Required - The unique identifier of the account for which to create a transaction. ``` -------------------------------- ### List Account Balances Source: https://context7.com/methodfi/method-node/llms.txt Retrieve a list of all available balance records for a given account. ```typescript const balances = await method.accounts('acc_yVf3mkzbhz9tj').balances.list(); ``` -------------------------------- ### Create Connect Source: https://github.com/methodfi/method-node/blob/master/README.md Initiates the process to identify and connect liability accounts for an entity. ```APIDOC ## Create Connect ### Description Initiates the process to identify and connect liability accounts for an entity. ### Method `method.entities(entityId).connect.create` ### Parameters #### Path Parameters - **entityId** (string) - Required - The unique identifier of the entity. ### Request Example ```javascript const entity = await method.entities("ent_qKNBB68bfHGNA").connect.create(); ``` ``` -------------------------------- ### Create a Webhook Source: https://github.com/methodfi/method-node/blob/master/README.md Creates a new webhook to receive event notifications. Requires specifying the event type, notification URL, and authentication details. ```javascript const webhook = await method.webhooks.create({ type: 'payment.update', url: 'https://api.example.app/webhook', auth_token: 'md7UqcTSmvXCBzPORDwOkE', hmac_secret: 'bd7UscLSmvEXazTOQDwOKW', }); ``` -------------------------------- ### Create and Manage Webhooks Source: https://context7.com/methodfi/method-node/llms.txt Register URLs to receive real-time event notifications. Webhooks can be created with HMAC signing for security, updated to change status, or deleted. Ensure the 'expand_event' option is set to true to include the full resource object in the event payload. ```typescript import { WebhookTypes } from 'method-node'; // Create a webhook with HMAC signing const webhook = await method.webhooks.create({ type: WebhookTypes.payment_update, // 'payment.update' url: 'https://api.example.app/webhooks/method', auth_token: 'md7UqcTSmvXCBzPORDwOkE', hmac_secret: 'bd7UscLSmvEXazTOQDwOKW', expand_event: true, // include full resource object in event payload metadata: { env: 'production' }, }); ``` ```typescript const whk = await method.webhooks.retrieve('whk_cSGjA6d9N8y8R'); const whks = await method.webhooks.list(); ``` ```typescript // Disable a webhook (without deleting) const disabled = await method.webhooks.update('whk_cSGjA6d9N8y8R', { status: 'disabled' }); ``` ```typescript // Delete await method.webhooks.delete('whk_cSGjA6d9N8y8R'); ``` -------------------------------- ### Create Entity Subscription Source: https://github.com/methodfi/method-node/blob/master/README.md Creates a new subscription for an entity. Requires the entity ID and the product name for the subscription (e.g., 'credit_score'). ```javascript const response = await method .entities("ent_TYHMaRJUUeJ7U") .subscriptions .create('credit_score'); ``` -------------------------------- ### List all Subscriptions Source: https://github.com/methodfi/method-node/blob/master/README.md Lists all subscriptions for an entity. ```APIDOC ## List all Subscriptions ### Description Lists all subscriptions for an entity. ### Method GET ### Endpoint /v1/entities/{entity_id}/subscriptions ### Parameters #### Path Parameters - **entity_id** (string) - Required - The ID of the entity. ### Response #### Success Response (200) - **subscriptions** (array) - A list of the entity's subscriptions. ``` -------------------------------- ### Webhooks Source: https://context7.com/methodfi/method-node/llms.txt Register URLs to receive real-time event notifications for any Method resource lifecycle event. ```APIDOC ## Webhooks — `method.webhooks` Register URLs to receive real-time event notifications for any Method resource lifecycle event. ### Create a webhook **Method:** `POST` (implied by `await method.webhooks.create(...)`) **Endpoint:** `/webhooks` (inferred) **Request Body:** - **type** (string) - Required - The type of event to receive notifications for (e.g., `payment.update`). - **url** (string) - Required - The URL to send notifications to. - **auth_token** (string) - Optional - An authentication token for the webhook. - **hmac_secret** (string) - Optional - A secret key for HMAC signing of notifications. - **expand_event** (boolean) - Optional - Whether to include the full resource object in the event payload. - **metadata** (object) - Optional - Custom metadata to associate with the webhook. ### Retrieve a webhook **Method:** `GET` (implied by `await method.webhooks.retrieve(...)`) **Endpoint:** `/webhooks/{id}` (inferred) **Parameters:** - **id** (string) - Required - The ID of the webhook to retrieve. ### List webhooks **Method:** `GET` (implied by `await method.webhooks.list(...)`) **Endpoint:** `/webhooks` (inferred) ### Update a webhook **Method:** `PUT` or `PATCH` (implied by `await method.webhooks.update(...)`) **Endpoint:** `/webhooks/{id}` (inferred) **Parameters:** - **id** (string) - Required - The ID of the webhook to update. **Request Body:** - **status** (string) - Optional - The new status of the webhook (e.g., `disabled`). ### Delete a webhook **Method:** `DELETE` (implied by `await method.webhooks.delete(...)`) **Endpoint:** `/webhooks/{id}` (inferred) **Parameters:** - **id** (string) - Required - The ID of the webhook to delete. ``` -------------------------------- ### Create Payment Source: https://github.com/methodfi/method-node/blob/master/README.md Initiates a funds transfer between a source and destination account. Requires amount, source account ID, destination account ID, and a description. ```javascript const payment = await method.payments.create({ amount: 5000, source: 'acc_JMJZT6r7iHi8e', destination: 'acc_AXthnzpBnxxWP', description: 'Loan Pmt', }); ``` -------------------------------- ### List Balances Source: https://github.com/methodfi/method-node/blob/master/README.md Lists all balance records for an account. Requires account ID. ```javascript const response = await method .accounts('acc_yVf3mkzbhz9tj') .balances .list(); ``` -------------------------------- ### List Accounts Source: https://github.com/methodfi/method-node/blob/master/README.md Retrieves a list of all accounts. ```javascript const accounts = await method.accounts.list(); ``` -------------------------------- ### Retrieve Account Product Source: https://github.com/methodfi/method-node/blob/master/README.md Retrieves a specific product for an account. Requires account ID and product ID. Some products may have restricted access. ```javascript const response = await method .accounts("acc_yVf3mkzbhz9tj") .products .retrieve("prd_FQFHqVNiCRb7J"); ``` -------------------------------- ### Create BYO KYC Verification Session Source: https://github.com/methodfi/method-node/blob/master/README.md Create a Bring Your Own (BYO) KYC verification session for an entity. This allows custom KYC flows to be initiated. ```javascript const response = await method .entities("ent_XgYkTdiHyaz3e") .verificationSessions .create({ type: "identity", method: "byo_kyc", byo_kyc: {}, }); ``` -------------------------------- ### Create and Retrieve Account Updates Source: https://context7.com/methodfi/method-node/llms.txt Use this to create a request for real-time account data updates and retrieve specific update information. Requires an account ID. ```typescript const updateReq = await method.accounts('acc_aEBDiLxiR8bqc').updates.create(); ``` ```typescript const update = await method.accounts('acc_aEBDiLxiR8bqc').updates.retrieve('upt_NYV5kfjskTTCJ'); ``` -------------------------------- ### Simulate API Calls in Development Source: https://context7.com/methodfi/method-node/llms.txt Use the `method.simulate` namespace exclusively in the `dev` environment to test event-driven flows by triggering state transitions for payments, accounts, entities, and more. This avoids waiting for real-world events. ```typescript // Advance a payment through its lifecycle await method.simulate.payments.update('pmt_rPrDPEwyCVUcm', { status: 'processing' }); await method.simulate.payments.update('pmt_rPrDPEwyCVUcm', { status: 'sent' }); await method.simulate.payments.update('pmt_rPrDPEwyCVUcm', { status: 'settled' }); ``` ```typescript // Simulate a failed payment with an error code await method.simulate.payments.update('pmt_rPrDPEwyCVUcm', { status: 'failed', error_code: 10001, }); ``` ```typescript // Simulate a transaction notification for a credit card account const txn = await method.simulate.accounts('acc_r6JUYN67HhCEM').transactions.create(); ``` ```typescript // Simulate a credit score update for an entity await method.simulate.entities('ent_au22b1fbFJbp8').creditScores.create(); ``` ```typescript // Simulate a Connect completion await method.simulate.entities('ent_au22b1fbFJbp8').connect.create(); ``` ```typescript // Simulate an attribute update await method.simulate.entities('ent_au22b1fbFJbp8').attributes.create(); ``` -------------------------------- ### Create Account Verification Session (Micro-deposits) Source: https://context7.com/methodfi/method-node/llms.txt Initiates a verification session for an ACH account using micro-deposits. This is required before the account can be used as a payment source. ```typescript const microSess = await method.accounts('acc_b9q2XVAnNFbp3').verificationSessions.create({ type: 'micro_deposits', }); ``` -------------------------------- ### Create Account Verification Session Source: https://github.com/methodfi/method-node/blob/master/README.md Initiates a new verification session for an account. The type of verification session must be specified. ```javascript const verification = await method .accounts('acc_b9q2XVAnNFbp3') .verificationSessions .create({ type: '' }); ``` -------------------------------- ### Retrieve a Specific Entity Product Source: https://context7.com/methodfi/method-node/llms.txt Fetch details for a single product associated with an entity. ```typescript const product = await method.entities('ent_TYHMaRJUUeJ7U').products.retrieve('prd_jPRDcQPMk43Ek'); ``` -------------------------------- ### Retrieve Account with Expanded Sub-resources Source: https://context7.com/methodfi/method-node/llms.txt Fetch an account's details, including expanded sub-resources like balance, card brand, and update status. Use the 'expand' option to specify which sub-resources to include. ```typescript // Retrieve with expanded sub-resources const account = await method.accounts.retrieve('acc_Zc4F2aTLt8CBt', { expand: ['balance', 'card_brand', 'update'], }); ``` -------------------------------- ### Create and Retrieve Account Card Brands Source: https://context7.com/methodfi/method-node/llms.txt Initiate a request to fetch credit card metadata and retrieve specific card brand information using the account and card brand IDs. ```typescript const cbReq = await method.accounts('acc_yVf3mkzbhz9tj').cardBrands.create(); ``` ```typescript const cbrand = await method.accounts('acc_yVf3mkzbhz9tj').cardBrands.retrieve('cbrd_eVMDNUPfrFk3e'); ``` -------------------------------- ### List Entity Products Source: https://context7.com/methodfi/method-node/llms.txt Retrieve a list of available, restricted, or unavailable products for a given entity. The response includes product status and subscription details. ```typescript const products = await method.entities('ent_TYHMaRJUUeJ7U').products.list(); /* { connect: { name: 'connect', status: 'available', is_subscribable: true, ... }, credit_score: { name: 'credit_score', status: 'available', ... }, identity: { name: 'identity', status: 'restricted', status_error: { ... } }, attribute: { name: 'attribute', status: 'available', ... } } */ ``` -------------------------------- ### Create and Retrieve Account Attributes Source: https://context7.com/methodfi/method-node/llms.txt Request and retrieve ML-derived account attributes such as usage patterns and delinquency status. Requires account ID. ```typescript const attrReq = await method.accounts('acc_yVf3mkzbhz9tj').attributes.create(); ``` ```typescript const attr = await method.accounts('acc_yVf3mkzbhz9tj').attributes.retrieve('aat_id_xxx'); ``` -------------------------------- ### Create Element Tokens for UI Components Source: https://context7.com/methodfi/method-node/llms.txt Generate short-lived tokens to launch Method's embeddable UI components, such as the Connect flow for account discovery. Pass the generated element token to the frontend library. Retrieve results after the element session completes. ```typescript import { ElementTypes } from 'method-node'; // Token for a Connect element (account discovery flow) const token = await method.elements.token.create({ type: ElementTypes.connect, // 'connect' entity_id: 'ent_au22b1fbFJbp8', team_name: 'My App', team_logo: 'https://myapp.com/logo.png', connect: { products: ['balance', 'update', 'card_brand'], account_filters: { selection_type: 'multiple', liability_types: ['credit_card', 'auto_loan'], }, }, }); // token.element_token => 'pk_elem_...' (pass to @methodfi/react-connect) ``` ```typescript // After the element session completes, retrieve results const results = await method.elements.token.results('pk_elem_session_id'); /* { authenticated: true, entity_id: 'ent_au22b1fbFJbp8', cxn_id: 'cxn_4ewMmBbjYDMR4', accounts: ['acc_xxx', 'acc_yyy'], events: [{ type: 'AUTH_SUCCESS_OPEN', timestamp: '...', metadata: null }] } */ ``` -------------------------------- ### List Entities Source: https://github.com/methodfi/method-node/blob/master/README.md Retrieves a list of all entities. ```APIDOC ## List Entities ### Description Retrieves a list of all entities. ### Method `method.entities.list` ### Request Example ```javascript const entities = await method.entities.list(); ``` ``` -------------------------------- ### List Accounts Source: https://github.com/methodfi/method-node/blob/master/README.md Retrieves a list of all accounts. ```APIDOC ## List Accounts ### Description Retrieves a list of all accounts associated with the current context. ### Method `method.accounts.list()` ### Request Example ```javascript const accounts = await method.accounts.list(); ``` ``` -------------------------------- ### List Updates Source: https://github.com/methodfi/method-node/blob/master/README.md Lists all updates for a given account. ```APIDOC ## List all Updates ### Description Retrieves a list of all updates associated with a specific account. ### Method `method.accounts(accountId).updates.list()` ### Parameters #### Path Parameters - **accountId** (string) - Required - The ID of the account to list updates for. ### Request Example ```javascript const response = await method .accounts('acc_yVf3mkzbhz9tj') .updates .list(); ``` ``` -------------------------------- ### Create a Report Source: https://github.com/methodfi/method-node/blob/master/README.md Creates a report with a specified type, such as 'payments.created.current'. ```javascript const report = await method.reports.create({ type: 'payments.created.current' }); ``` -------------------------------- ### Create Opal Tokens for Embedded UI Source: https://context7.com/methodfi/method-node/llms.txt Generate tokens for various Opal modes like identity verification, connect, and account verification. Ensure the correct `entity_id` and mode-specific configurations are provided. ```typescript // Identity verification mode const opalToken = await method.opal.token.create({ mode: 'identity_verification', entity_id: 'ent_au22b1fbFJbp8', identity_verification: { skip_pii: ['dob', 'ssn_4'], }, }); // opalToken.token, opalToken.valid_until, opalToken.session_id ``` ```typescript // Connect mode with account filters const connectToken = await method.opal.token.create({ mode: 'connect', entity_id: 'ent_au22b1fbFJbp8', connect: { skip_pii: [], selection_type: 'multiple', account_filters: { include: { account_types: ['credit_card', 'auto_loan'] }, exclude: { account_types: [], mch_ids: ['mch_blocked'], unverified_account_numbers: true }, }, }, }); ``` ```typescript // Account verification mode const avToken = await method.opal.token.create({ mode: 'account_verification', entity_id: 'ent_au22b1fbFJbp8', account_verification: { account_id: 'acc_yVf3mkzbhz9tj' }, }); ``` -------------------------------- ### Account Payment Instruments Source: https://context7.com/methodfi/method-node/llms.txt Generate card or network token payment instruments for an account. ```APIDOC ## Account Payment Instruments — `method.accounts(id).paymentInstruments` Generate card or network token payment instruments for an account. ### Create a payment instrument ```typescript const instrument = await method.accounts('acc_yVf3mkzbhz9tj').paymentInstruments.create({ type: 'card', // or 'network_token' }); /* { type: 'card', card: { number: '4111111111111111', exp_month: 9, exp_year: 2027 }, chargeable: true, status: 'completed' } */ ``` ### Retrieve a payment instrument ```typescript const inst = await method.accounts('acc_yVf3mkzbhz9tj').paymentInstruments.retrieve('pi_id_xxx'); ``` ### List payment instruments ```typescript const list = await method.accounts('acc_yVf3mkzbhz9tj').paymentInstruments.list(); ``` ``` -------------------------------- ### Create Account Update Source: https://github.com/methodfi/method-node/blob/master/README.md Creates an update for a specific account. Requires account ID. ```javascript const response = await method .accounts('acc_aEBDiLxiR8bqc') .updates .create(); ``` -------------------------------- ### Entity Products Source: https://context7.com/methodfi/method-node/llms.txt Inspect which Method products are available, restricted, or unavailable for an Entity. ```APIDOC ## Entity Products — `method.entities(id).products` Inspect which Method products (Connect, Credit Score, Identity, Attribute, Vehicle) are available, restricted, or unavailable for an Entity. ### List Products ```typescript const products = await method.entities('ent_TYHMaRJUUeJ7U').products.list(); /* { connect: { name: 'connect', status: 'available', is_subscribable: true, ... }, credit_score: { name: 'credit_score', status: 'available', ... }, identity: { name: 'identity', status: 'restricted', status_error: { ... } }, attribute: { name: 'attribute', status: 'available', ... } } */ ``` ### Retrieve Product ```typescript const product = await method.entities('ent_TYHMaRJUUeJ7U').products.retrieve('prd_jPRDcQPMk43Ek'); ``` ``` -------------------------------- ### Create BYO KYC Verification Source: https://github.com/methodfi/method-node/blob/master/README.md Creates a Bring Your Own KYC (BYO KYC) verification session for an entity. ```APIDOC ## Create BYO KYC Verification ### Description Creates a Bring Your Own KYC (BYO KYC) verification session for an entity. ### Method `method.entities(entityId).verificationSessions.create` ### Parameters #### Path Parameters - **entityId** (string) - Required - The unique identifier of the entity. #### Request Body - **type** (string) - Required - Must be 'identity'. - **method** (string) - Required - Must be 'byo_kyc'. - **byo_kyc** (object) - Required - An empty object, as BYO KYC details are handled externally. ### Request Example ```javascript const response = await method.entities("ent_XgYkTdiHyaz3e").verificationSessions.create({ type: "identity", method: "byo_kyc", byo_kyc: {}, }); ``` ``` -------------------------------- ### List Account Updates Source: https://context7.com/methodfi/method-node/llms.txt Fetches a list of all available account updates for a given account ID. Ensure the account ID is correct. ```typescript const updates = await method.accounts('acc_yVf3mkzbhz9tj').updates.list(); ``` -------------------------------- ### Create Update Source: https://github.com/methodfi/method-node/blob/master/README.md Creates a new update for a given account. ```APIDOC ## Create an Update ### Description Initiates the creation of an update for a specific account to retrieve real-time data. ### Method `method.accounts(accountId).updates.create()` ### Parameters #### Path Parameters - **accountId** (string) - Required - The ID of the account for which to create an update. ### Request Example ```javascript const response = await method .accounts('acc_aEBDiLxiR8bqc') .updates .create(); ``` ``` -------------------------------- ### Simulate Payment Status Update Source: https://github.com/methodfi/method-node/blob/master/README.md Simulates an update to a payment's status. This is only available in the development environment. ```javascript const payment = await method .simulate .payments .update('pmt_rPrDPEwyCVUcm', { status: 'processing' }); ``` -------------------------------- ### Create Payment Instrument Source: https://context7.com/methodfi/method-node/llms.txt Generates a payment instrument, which can be a card or a network token, for an account. This instrument can then be used for payments. ```typescript const instrument = await method.accounts('acc_yVf3mkzbhz9tj').paymentInstruments.create({ type: 'card', // or 'network_token' }); ``` -------------------------------- ### List Accounts with Filters Source: https://context7.com/methodfi/method-node/llms.txt Retrieve a list of accounts associated with an entity, with options to filter by holder ID, account type (e.g., 'liability'), specific liability types (e.g., 'credit_card'), and pagination limits. ```typescript // List with filters const accounts = await method.accounts.list({ holder_id: 'ent_au22b1fbFJbp8', type: 'liability', 'liability.type': 'credit_card', page_limit: 20, }); ``` -------------------------------- ### Create Individual Entity Source: https://github.com/methodfi/method-node/blob/master/README.md Create an individual entity with personal details and address. This is required for most services and enables features based on PII requirements. ```javascript const entity = await method.entities.create({ type: "individual", individual: { first_name: "Kevin", last_name: "Doyle", phone: "+16505555555", email: "kevin.doyle@gmail.com", dob: "1997-03-18", }, address: { line1: "3300 N Interstate 35", line2: null, city: "Austin", state: "TX", zip: "78705", }, }); ``` -------------------------------- ### Create Liability Account Source: https://github.com/methodfi/method-node/blob/master/README.md Use this to create a new liability account. Requires holder ID and liability details. ```javascript const account = await method.accounts.create({ holder_id: 'ent_au22b1fbFJbp8', liability: { mch_id: 'mch_2', account_number: '1122334455', } }); ``` -------------------------------- ### Create Individual Entity Source: https://context7.com/methodfi/method-node/llms.txt Create a new individual entity with personal details, contact information, and address. The entity's ID and status are returned upon creation. ```typescript // Create an individual entity const entity = await method.entities.create({ type: 'individual', individual: { first_name: 'Kevin', last_name: 'Doyle', phone: '+16505555555', email: 'kevin.doyle@gmail.com', dob: '1997-03-18', }, address: { line1: '3300 N Interstate 35', line2: null, city: 'Austin', state: 'TX', zip: '78705', }, }); // entity.id => 'ent_au22b1fbFJbp8' // entity.status => 'active' | 'incomplete' | 'disabled' ``` -------------------------------- ### Error Handling Source: https://context7.com/methodfi/method-node/llms.txt The SDK throws typed error subclasses. Wrap all calls in try/catch and inspect `error.type`, `error.code`, and `error.message` for detailed error information. ```APIDOC ## Error Handling — `MethodError` The SDK throws typed error subclasses. Wrap all calls in try/catch and inspect `error.type`, `error.code`, and `error.message`. ```typescript import { MethodAuthorizationError, MethodInvalidRequestError, MethodInternalError, } from 'method-node'; try { const entity = await method.entities.retrieve('ent_invalid'); } catch (err) { if (err instanceof MethodAuthorizationError) { // 401 – bad or missing API key console.error('Auth failed:', err.message, err.code); } else if (err instanceof MethodInvalidRequestError) { // 400 – malformed request / validation error console.error('Bad request:', err.message, err.sub_type); } else if (err instanceof MethodInternalError) { // 5xx – Method platform error console.error('Server error:', err.message); } } ``` ``` -------------------------------- ### Account Balances Source: https://context7.com/methodfi/method-node/llms.txt Pull real-time balances directly from an account's financial institution. ```APIDOC ## Account Balances — `method.accounts(id).balances` Pull real-time balances directly from an account's financial institution. ### Create Balance Request ```typescript const balanceReq = await method.accounts('acc_yVf3mkzbhz9tj').balances.create(); // balanceReq.status => 'pending' | 'completed' | 'failed' ``` ### Retrieve Balance ```typescript const balance = await method.accounts('acc_yVf3mkzbhz9tj').balances.retrieve('bal_ebzh8KaR9HCBG'); // balance.amount => 123456 (in cents) ``` ### List Balances ```typescript const balances = await method.accounts('acc_yVf3mkzbhz9tj').balances.list(); ``` ```