All Projects → bunq → Sdk_python

bunq / Sdk_python

Licence: mit
Python SDK for bunq API

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Sdk python

clabe-validator
🇲🇽 Analyze or create a CLABE number for a Mexican bank account (written in functional TypeScript)
Stars: ✭ 55 (-28.57%)
Mutual labels:  bank, financial
Awesome Ai In Finance
🔬 A curated list of awesome machine learning strategies & tools in financial market.
Stars: ✭ 910 (+1081.82%)
Mutual labels:  financial
Finance
A self hosted app to help you get a better understanding of your personal finances.
Stars: ✭ 313 (+306.49%)
Mutual labels:  bank
Acme bank
An example ☂ project
Stars: ✭ 700 (+809.09%)
Mutual labels:  bank
Finquant
A program for financial portfolio management, analysis and optimisation.
Stars: ✭ 395 (+412.99%)
Mutual labels:  financial
Cnbankcard
🏦 由银行卡卡号解析出发卡行和卡别,适用于中国国内多数银行,返回JSON数据。
Stars: ✭ 853 (+1007.79%)
Mutual labels:  bank
Fixed
high performance fixed decimal place math library for Go
Stars: ✭ 263 (+241.56%)
Mutual labels:  financial
Alexa Monzo
Monzo Skill for the Amazon Alexa
Stars: ✭ 49 (-36.36%)
Mutual labels:  bank
Augmint Web
Augmint Web Frontend
Stars: ✭ 15 (-80.52%)
Mutual labels:  financial
Banks Db
Community driven database to get bank info (name, brand color etc.) by bankcard prefix (BIN)
Stars: ✭ 672 (+772.73%)
Mutual labels:  bank
Financialcustomerview
各种金融类的自定义View,基金走势图、分时图、蜡烛图、各种指标等,一步一步构建庞大的基金自定View...
Stars: ✭ 642 (+733.77%)
Mutual labels:  financial
Plotly
Plotly for Rust
Stars: ✭ 433 (+462.34%)
Mutual labels:  financial
Contractmanager
ContractManager is a contract management software for the Jameica platform.
Stars: ✭ 10 (-87.01%)
Mutual labels:  financial
Decimal
A high-performance, arbitrary-precision, floating-point decimal library.
Stars: ✭ 363 (+371.43%)
Mutual labels:  financial
Py Sec Edgar
Python application used to download, parse, and extract filings from the SEC Edgar Database (including 10-K, 10-Q, 13-D, S-1, 8-K, etc.)
Stars: ✭ 35 (-54.55%)
Mutual labels:  financial
Mand Mobile
💰 A mobile UI toolkit, based on Vue.js 2, designed for financial scenarios.
Stars: ✭ 3,194 (+4048.05%)
Mutual labels:  financial
Budget
Get a grip on your finances.
Stars: ✭ 609 (+690.91%)
Mutual labels:  financial
Bankformtex
A SEPA bank transfer form with IBAN
Stars: ✭ 7 (-90.91%)
Mutual labels:  bank
Banksystem
ASP.NET Core banking system with secure communication capability between instances, cards, secure payments, etc.
Stars: ✭ 70 (-9.09%)
Mutual labels:  bank
Wscef Docker
Warsaw in docker container
Stars: ✭ 47 (-38.96%)
Mutual labels:  bank

bunq Python SDK

Introduction

Hi developers!

Welcome to the bunq Python SDK! 👨‍💻

We're very happy to introduce yet another unique product: complete banking SDKs! Now you can build even bigger and better apps and integrate them with your bank of the free! 🌈

Before you dive into this brand new SDK, please consider:

Give us your feedback, create pull requests, build your very own bunq apps and most importantly: have fun! 💪

This SDK is in beta. We cannot guarantee constant availability or stability. Thanks to your feedback we will make improvements on it.

Installation

pip install bunq_sdk --upgrade

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.create(ENVIRONMENT_TYPE, API_KEY, DEVICE_DESCRIPTION)
apiContext.save(API_CONTEXT_FILE_PATH)

Please note: initialising your application is a heavy task and it is recommended to do it only once per device.

apiContext = ApiContext.restore(self.API_CONTEXT_FILE_PATH)
BunqContext.loadApiContext(apiContext)

After saving the context, you can restore it at any time:

Example

See tinker/setup_context

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:

apiContext = ApiContext.create_for_psd2(ENVIRONMENT_TYPE, CERTIFICATE, PRIVATE_KEY, CERTIFICATE_CHAIN, DEVICE_DESCRIPTION)

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.

Sometimes API calls have dependencies, for instance MonetaryAccount. Making changes to a monetary account always also needs a reference to a User. These dependencies are required as arguments when performing API calls. Take a look at doc.bunq.com for the full documentation.

Creating objects

Creating objects through the API requires an ApiContext, a requestMap and identifiers of all dependencies (such as User ID required for accessing a Monetary Account). Optionally, custom headers can be passed to requests.

payment_id = Payment.create(
    amount=Amount(amount_string, self._CURRENCY_EURL),
    counterparty_alias=Pointer(self._POINTER_TYPE_EMAIL, recipient),
    description=description
)
Example

See tinker/make_payment

Reading objects

Reading objects through the API requires an ApiContext, identifiers of all dependencies (such as User ID required for accessing a Monetary Account), and the identifier of the object to read (ID or UUID) Optionally, custom headers can be passed to requests.

This type of calls always returns a model.

monetary_account = generated.MonetaryAccountBank.get(
    _MONETARY_ACCOUNT_ITEM_ID
)
Example

See tinker/list_all_payment

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.

Card.update(
    card_id=int(card_id),
    monetary_account_current_id=int(account_id)
)
Example

See tinker/update_card

Deleting objects

Deleting objects through the API requires an ApiContext, identifiers of all dependencies (such as User ID required for accessing a Monetary Account), and the identifier of the object to delete (ID or UUID) Optionally, custom headers can be passed to requests.

Session.delete(self._SESSION_ID)
Example

Listing objects

Listing objects through the API requires an ApiContext and identifiers of all dependencies (such as User ID required for accessing a Monetary Account). Optionally, custom headers can be passed to requests.

users = User.list(api_context)
Example

See UserListExample.py

Running Samples

To get an indication on how the SDK works you can use the python tinker which is located at https://github.com/bunq/tinker_python

Running Tests

Information regarding the test cases can be found in the README.md located in test.

Exceptions

The SDK can raise multiple exceptions. For an overview of these exceptions please take a look at EXCEPTIONS.md.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].