0.3.39 • Published 17 hours ago

method-node v0.3.39

Weekly downloads
-
License
ISC
Repository
github
Last release
17 hours ago

method-node

Node.js library for the Method API

NPM

Install

npm install --save method-node

Usage

import { Method, Environments } from 'method-node';
const method = new Method({
  apiKey: '<API_KEY>',
  env: Environments.dev,
});

Entities

Create 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',
  },
});

Create Corporation Entity

const entity = await method.entities.create({
  type: 'c_corporation',
  corporation: {
    name: 'Alphabet Inc.',
    dba: 'Google',
    ein: '641234567',
    owners: [
      {
        first_name: 'Sergey',
        last_name: 'Brin',
        phone: '+16505555555',
        email: 'sergey@google.com',
        dob: '1973-08-21',
        address: {
          line1: '600 Amphitheatre Parkway',
          line2: null,
          city: 'Mountain View',
          state: 'CA',
          zip: '94043',
        },
      },
    ],
  },
  address: {
    line1: '1600 Amphitheatre Parkway',
    line2: null,
    city: 'Mountain View',
    state: 'CA',
    zip: '94043',
  },
});

Retrieve Entity

const entity = await method.entities.get('ent_au22b1fbFJbp8');

Update Entity

const entity = await method.entities.update('ent_au22b1fbFJbp8', {
  individual: {
    first_name: 'Kevin',
    last_name: 'Doyle',
    email: 'kevin.doyle@gmail.com',
    dob: '1997-03-18',
  },
});

List Entities

const entities = await method.entities.list();

Refresh Capabilities

const entity = await method.entities.refreshCapabilities('ent_au22b1fbFJbp8');

Create Individual Auth Session

const response = await method.entities.createAuthSession('ent_au22b1fbFJbp8');

Update Individual Auth Session

const response = await method.entities.updateAuthSession('ent_au22b1fbFJbp8', {
  answers: [
    {
      "question_id": "qtn_ywWqCnXDGGmmg",
      "answer_id": "ans_74H68MJjqNhk8"
    },
    ...
  ]
});

Accounts

Create Ach Account

const account = await method.accounts.create({
  holder_id: 'ent_y1a9e1fbnJ1f3',
  ach: {
    routing: '367537407',
    number: '57838927',
    type: 'checking',
  },
});

Create Liability Account

const account = await method.accounts.create({
  holder_id: 'ent_au22b1fbFJbp8',
  liability: {
    mch_id: 'mch_2',
    account_number: '1122334455',
  }
});

Retrieve Account

const account = await method.accounts.get('acc_Zc4F2aTLt8CBt');

List Accounts

const accounts = await method.accounts.list();

ACH Verification

Create Micro-Deposits Verification

const verification = await method
  .accounts('acc_b9q2XVAnNFbp3')
  .verification
  .create({ type: 'micro_deposits' });

Create Plaid Verification

const verification = await method
  .accounts('acc_b9q2XVAnNFbp3')
  .verification
  .create({
    type: 'plaid',
    plaid: {
      balances: {
        available : 100,
        current : 110,
        iso_currency_code : 'USD',
        limit : null,
        unofficial_currency_code : null,
      },
      transactions: [
        ...
      ],
    },
  });

Create Teller Verification

const verification = await method
  .accounts('acc_b9q2XVAnNFbp3')
  .verification
  .create({
    type: 'teller',
    teller: {
      balances: {
        account_id: 'acc_ns9gkibeia6ad0rr6s00q',
        available: '93011.13',
        ledger: '93011.13',
        links: {
          account: 'https://api.teller.io/accounts/acc_ns9gkibeia6ad0rr6s00q',
          self: 'https://api.teller.io/accounts/acc_ns9gkibeia6ad0rr6s00q/balances'
        },
      },
      transactions: [
        {
          account_id: 'acc_ns9gkia42a6ad0rr6s000',
          amount: '-51.19',
          date: '2022-01-04',
          description: 'Venmo Payment',
          details: {
            category: 'services',
            counterparty: {
              name: 'LOUISE BENTLEY',
              type: 'person',
            },
            processing_status: 'complete',
          },
          id: 'txn_ns9gkiph2a6ad0rr6s000',
          links: {
            account: 'https://api.teller.io/accounts/acc_ns9gkia42a6ad0rr6s000',
            self: 'https://api.teller.io/accounts/acc_ns9gkia42a6ad0rr6s000/transactions/txn_ns9gkiph2a6ad0rr6s000',
          },
          running_balance: null,
          status: 'pending',
          type: 'digital_payment',
        },
      ],
    },
  });

Create MX Verification

const verification = await method
  .accounts('acc_b9q2XVAnNFbp3')
  .verification
  .create({
    type: 'mx',
    mx: {
      account : {
        institution_code: 'chase',
        guid: 'ACT-06d7f44b-caae-0f6e-1384-01f52e75dcb1',
        account_number: null,
        apr: null,
        apy: null,
        available_balance: 1000.23,
        available_credit: null,
        balance: 1000.23,
        cash_balance: 1000.32,
        cash_surrender_value: 1000.23,
        created_at: '2016-10-13T17:57:37+00:00',
        ...
      },
      transactions: [
        ...
      ],
    },  
  );

Update Verification

const verification = await method
  .accounts('acc_b9q2XVAnNFbp3')
  .verification
  .update({
    micro_deposits: {
      amounts: [10, 4],
    },
  });

Retrieve Verification

const verification = await method
  .accounts('acc_b9q2XVAnNFbp3')
  .verification
  .get();

Merchants

List Merchants

const merchants = await method.merchants.list();

Retrieve Merchant

const merchant = await method.merchants.get('mch_1');

Payments

Create Payment

const payment = await method.payments.create({
  amount: 5000,
  source: 'acc_JMJZT6r7iHi8e',
  destination: 'acc_AXthnzpBnxxWP',
  description: 'Loan Pmt',
});

Retrieve Payment

const payment = await method.payments.get('pmt_rPrDPEwyCVUcm');

Delete Payment

const payment = await method.payments.delete('pmt_rPrDPEwyCVUcm');

List Payments

const payments = await method.payments.list();

Reversals

Retrieve Reversal

const reversal = await method.payments('pmt_rPrDPEwyCVUcm').reversals.get('rvs_eaBAUJtetgMdR');

Update Reversal

const reversal = await method
  .payments('pmt_rPrDPEwyCVUcm')
  .reversals
  .update('rvs_eaBAUJtetgMdR', { status: 'pending' });

List Reversals for Payment

const reversals = await method.payments('pmt_rPrDPEwyCVUcm').reversals.list();

Webhooks

Create Webhook

const webhook = await method.webhooks.create({
  type: 'payment.update',
  url: 'https://api.example.app/webhook',
  auth_token: 'md7UqcTSmvXCBzPORDwOkE',
});

Retrieve Webhook

const webhook = await method.webhooks.get('whk_cSGjA6d9N8y8R');

Delete Webhoook

const webhook = await method.webhooks.delete('whk_cSGjA6d9N8y8R');

List Webhooks

const webhooks = await method.webhooks.list();

Reports

Create Report

const report = await method.reports.create({ type: 'payments.created.current' });

Retrieve Report

const report = await method.reports.get('rpt_cj2mkA3hFyHT5');

Download Report

const reportCSV = await method.reports.download('rpt_cj2mkA3hFyHT5');
0.3.39

17 hours ago

0.3.38

5 days ago

0.3.37

5 days ago

0.3.36

2 months ago

0.3.35

2 months ago

0.3.34

3 months ago

0.3.33

3 months ago

0.3.32

3 months ago

0.3.31

3 months ago

0.3.30

3 months ago

0.3.29

3 months ago

0.3.28

3 months ago

0.3.27

3 months ago

0.3.26

3 months ago

0.3.25

4 months ago

0.3.24

4 months ago

0.3.23

4 months ago

0.3.22

5 months ago

0.3.21

5 months ago

0.3.20

6 months ago

0.3.19

7 months ago

0.3.18

11 months ago

0.3.17

1 year ago

0.3.16

1 year ago

0.3.15

1 year ago

0.3.14

1 year ago

0.3.13

1 year ago

0.3.12

1 year ago

0.3.11

2 years ago

0.3.10

2 years ago

0.3.9

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.8

2 years ago

0.3.7

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.2.20

2 years ago

0.3.0

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.2.19

2 years ago

0.2.18

2 years ago

0.2.16

2 years ago

0.2.15

2 years ago

0.2.14

2 years ago

0.2.17

2 years ago

0.2.13

2 years ago

0.2.12

3 years ago

0.2.11

3 years ago

0.2.10

3 years ago

0.2.0

3 years ago

0.2.6

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago