brex-api
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',
})
;(async () => {
const response = await brex.vendors.list()
console.log(response.list)
})()
brex.vendors.list().then((response) => {
console.log(response.list)
})
Follow Brex developer documentation to obtain an access token.
Working with transfers:
const listTransferRes = await brex.transfers.list()
const createTransferRes = await brex.transfers.create({
amount: {
amount: 12340,
currency: 'USD',
},
description: 'Test transfer',
counterparty: {
type: 'VENDOR',
paymentInstrumentId: 'vendor_payment_instrument_id',
},
externalMemo: 'ACH PMT',
cashAccountId: 'your_cash_account_id',
})
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
> yarn install
> yarn lint:fix
> yarn format:fix
> yarn build
> yarn types
> yarn dist
> 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!