0.8.0 • Published 3 months ago

@maroo-us/brex-api v0.8.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

brex-api NPM Test

Unofficial JS/TS wrapper for Brex (c) API.

Installation

yarn add @maroo-us/brex-api

Usage

import { BrexClient } from '@maroo-us/brex-api'

const brex = new BrexClient({
  accessToken: 'your_access_token',
})

// ES async/await
;(async () => {
  const response = await brex.vendors.list()
  console.log(response.list)
})()

// Promises
brex.vendors.list().then((response) => {
  console.log(response.list)
})

Follow Brex developer documentation to obtain an access token.

Working with transfers:

// List existing transfers
const listTransferRes = await brex.transfers.list()

// Create a new transfer
const createTransferRes = await brex.transfers.create({
  amount: {
    // Transfer Amount as cents
    amount: 12340,
    currency: 'USD',
  },
  description: 'Test transfer',
  counterparty: {
    type: 'VENDOR',
    paymentInstrumentId: 'vendor_payment_instrument_id',
  },
  externalMemo: 'ACH PMT',
  cashAccountId: 'your_cash_account_id',
})

// Get existing transfer
const getTransferRes = await brex.transfers.get('transfer_id')

If you want to connect to Brex staging environment, you can specify optional environment property in the initialization options:

import { BrexClient, BrexEnvironment } from '@maroo-us/brex-api'

const brex = new BrexClient({
  accessToken: 'your_access_token',
  environment: BrexEnvironment.Staging,
})

By default, the production environment is used.

Development

# Install dependencies
> yarn install

# Lint project files
> yarn lint:fix

# Format project files
> yarn format:fix

# Build the project
> yarn build

# Generate TS declaration file
> yarn types

# Create dist tarball
> yarn dist

# Prepare a new release
> npm version patch|minor|major
> npm publish --access=public
> git push && git push --tags

License

Maroo-us/brex-api — Licensed under the MIT License.

“Brex” and the Brex logo — registered trademarks of ”Brex Inc.”

Pull/feature requests and issue posting are highly appreciated!

0.8.0

3 months ago

0.7.0

1 year ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago