Usage

Creating an API context

In order to start making calls with the bunq API, you must first register your API key and device, and create a session. In the SDKs, we group these actions and call it "creating an API context". The context can be created by using the following code snippet:

ApiContext apiContext = ApiContext.create(
    ApiEnvironmentType.SANDBOX,
    sandboxUser.getApiKey(),
    "Your Device Description"
);
apiContext.save("bunq-config.conf");

BunqContext.loadApiContext(apiContext); //load the API context to use in your app

PSD2

It is possible to create an ApiContext as PSD2 Service Provider. Although this might seem a complex task, we wrote some helper implementations to get you started. You need to create a certificate and private key to get you started. Our sandbox environment currently accepts all certificates, if these criteria are met:

  • Up to 64 characters

  • PISP and/or AISP used in the end.

Make sure you have your unique eIDAS certificate number and certificates ready when you want to perform these tasks on our production environment.

Creating a PSD2 context is very easy:

This context can be saved the same way as a normal ApiContext. After creating this context, create an OAuth client to get your users to grant you access. For a more detailed example, check the tinker_java repository.

Safety considerations

The file storing the context details (i.e. bunq.conf) is a key to your account. Anyone having access to it is able to perform any Public API actions with your account. Therefore, we recommend choosing a truly safe place to store it.

Making API calls

There is a class for each endpoint. Each class has functions for each supported action. These actions can be create, get, update, delete and list.

When making calls, The userId and monetaryAccountId needed to make calls will be determined by the SDK it. When no monetaryAccountId has been passed, the SDK will use the first active monetary account it can find. This is normally the monetary account used for billing.

Before you make a call, make sure that you have loaded ApiContext in to the BunqContext.

Core Functionalities

Managing Monetary Accounts

Create a new monetary account:

Close a monetary account:

Payments

Make a payment to another user:

Batch payments:

Payment Requests

Create a payment request:

Accept a payment request:

Card Management

Get possible card names:

Order a new card:

File Attachments

Upload a public attachment:

Retrieve an attachment:

Avatar Management

Create an avatar:

Session Management

Delete the current session:

Reset a session:

Notification Filters (Webhooks)

Create a URL notification filter for a monetary account:

Create a push notification filter for a user:

OAuth Authorization

Create an OAuth authorization URI:

Creating objects

With the create method you can create new models. This method normally returns the id of the created model.

Reading objects

Reading objects can be done via the get or list method.

These type of calls always returns the model or binary data.

Updating objects

Updating objects through the API goes the same way as creating objects, except that also the object to update identifier (ID or UUID) is needed.

The update method will also normally return the Id of the updated model.

Deleting objects

Deleting object can be done via the delete method. This method also requires the object identifier which could be an Id or uuid.

This method normally returns an empty response.

Tips for Using the SDK

  1. Always ensure your API context is properly loaded before making API calls

  2. Request spending money in the sandbox environment when needed:

  3. Save your API context after making changes to it

  4. Remember to refresh your context periodically for long-running applications:

Last updated

Was this helpful?