A node.js client library for the dapi API.
Table of Contents
$ npm i @dapi-co/dapi-node
The module supports all dapi API endpoints. For complete information about the API, you can check out the docs here.
APP_ENV must be provided for successful creation of the dapi api client.
const Dapi =const client =appKey: processenvAPP_KEYappSecret: processenvAPP_SECRETappEnv: processenvAPP_ENV || 'sandbox'webhooks: ''
appEnv parameter dictates which dapi API environment you will access. Values are:
sandbox: Sandbox environment, connects to sandbox.dapi.co
production: Production environment, connects to production.dapi.co
webhooks parameter is optional. By default, if not provided, when a notification is to be sent, it'll be sent to all your registered webhook urls for that app on the developer dashboard. If provided, a notification will be sent, only to the these webhook urls. They have to match the ones set in the developer dashboard.
job is created on each of the methods, except the
exchangeToken method. The result of the job will be returned via webhooks. For more information, read the docs
Once an instance of the client has been created you use the following methods:
const access_code ='access code should be optained from dapi-connect and passed to your app'const access_token = await clientconst identity = await clientconst user_accounts = await clientconst account_balance = await clientconst transactions = await clientconst beneficiary_list = await clientconst payment_job_id = await clientawait client
All methods are async and are wrapped in promises.
catch all of them, or chain them using
Open an issue!