A wrapper for part of the bunq API v1 in Type-/JavaScript forked from Simon Schraeders https://github.com/c0dr/bunq
-
authentication procedure with bunq server consisting of
- key creation and installation
- device server registration with API key
- session server registration to get session auth token
-
- user
- balance
- payments
- node.js
apt-get install nodejs
npm install -g npm@latest
- typescript
npm install -g typescript
- jest
npm install -g jest
git clone https://github.com/cofdev0/bunq-api.git bunq
cd bunq
npm install
tsc
npm run test
- create a public/private key pair
- change secretsPath in bunq.json to point to an existing directory for your secret data
npm run createKey
- change file names of created key files
- change publicKeyFile and privateKeyFile in bunq.json to point to newly created key files
- install public key with bunq server
npm run installKey
- rename newly created JSON file with installationToken in your secretPath
- have installationTokenFile in bunq.json point to this installationToken file in your secretPath
- create device server with bunq
- have secretsFile in bunq.json point to your secret configuration JSON file
- the secret configuration file must contain the secret API key you receive from bunq and a description of your server
- like so: { 'secret' : 'nWmbY4QqXra...', 'description':'my bunq dev server' }
npm run createDeviceServer
- create first session with bunq server
- have bunqSessionFile in bunq.json point to the JSON file where to store the current session
- have bunqSessionHistoryPath in bunq.json point to a directory where to store history of sessions
npm run createSession
- find your user id
npm run requestUser
- find your user id in the JSON output and enter it into your secret config file with key userId
- add "accountId" : "" in your secret config file
- find your account id
npm run showAccount
- find your account id in the JSON output and update your secret config file accordingly
- show all payments on your account
npm run requestPayments
- send payment to IBAN
npm run sendPayment -- --iban NL09BUNQ2290519588 --amount 10 --description donation --name StichtingChainsOfFreedom --sendPayment
- well done! thanks!
-
install notification filter to receive notification on payment
- create server certificate to allow https connection (below)
- have notificationKeyFile and notificationCertFile in secret configuration file point to certificate files
npm run installNotification -- https://my.domain.com/callback
-
example server to receive notification on payments
- execute on server of notified domain:
npm run runCallbackServer
- selfsigned certificate
openssl genrsa -out server.key 2048
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
- certificate from letsencrypt.org using certbot.eff.org
certbot certonly --standalone -d your-domain-name.com
- renew certificate twice per day with a crontab job:
11 0,12 * * * /usr/bin/certbot certonly --quiet --standalone --renew-by-default -d your-domain-name.com
import {
BunqKey, BunqApi, BunqApiConfig, BunqApiSetup,
BunqConnection, BunqServerConnection, SessionCreator
} from 'bunq-api/dist/index';
- for some examples check e.g.
- install dts-generator
npm install -g dts-generator
- create types with:
npm run createTypes
- create package for testing
npm pack
- publish to npmjs.com
npm login
npm publish