Skip to main content

Python client for GoCardless Bank Account Data API

Project description

Nordigen Python

⚠️ Notice

Please be advised that the Bank Account Data libraries are no longer actively updated or maintained. While these libraries may still function, GoCardless will not provide further updates, bug fixes, or support for them.

This is official Python client library for GoCardless Bank Account Data API

For a full list of endpoints and arguments, see the docs.

Before starting to use API you will need to create a new secret and get your SECRET_ID and SECRET_KEY from the GoCardless Bank Account Data Portal.

Requirements

  • Python >= 3.8

Installation

Install library via pip package manager:

pip install nordigen

Example application

Example code can be found in main.py file and Flask application can be found in the example directory

Quickstart

from uuid import uuid4

from nordigen import NordigenClient

# initialize Nordigen client and pass SECRET_ID and SECRET_KEY
client = NordigenClient(
    secret_id="SECRET_ID",
    secret_key="SECRET_KEY"
)

# Create new access and refresh token
# Parameters can be loaded from .env or passed as a string
# Note: access_token is automatically injected to other requests after you successfully obtain it
token_data = client.generate_token()

# Use existing token
client.token = "YOUR_TOKEN"

# Exchange refresh token for new access token
new_token = client.exchange_token(token_data["refresh"])

# Get institution id by bank name and country
institution_id = client.institution.get_institution_id_by_name(
    country="LV",
    institution="Revolut"
)

# Get all institution by providing country code in ISO 3166 format
institutions = client.institution.get_institutions("LV")

# Initialize bank session
init = client.initialize_session(
    # institution id
    institution_id=institution_id,
    # redirect url after successful authentication
    redirect_uri="https://gocardless.com",
    # additional layer of unique ID defined by you
    reference_id=str(uuid4())
)

# Get requisition_id and link to initiate authorization process with a bank
link = init.link # bank authorization link
requisition_id = init.requisition_id

After successful authorization with a bank you can fetch your data (details, balances, transactions)


Fetching account metadata, balances, details and transactions

# Get account id after you have completed authorization with a bank
# requisition_id can be gathered from initialize_session response
accounts = client.requisition.get_requisition_by_id(
    requisition_id=init.requisition_id
)

# Get account id from the list.
account_id = accounts["accounts"][0]

# Create account instance and provide your account id from previous step
account = client.account_api(id=account_id)

# Fetch account metadata
meta_data = account.get_metadata()
# Fetch details
details = account.get_details()
# Fetch balances
balances = account.get_balances()
# Fetch transactions
transactions = account.get_transactions()
# Filter transactions by specific date range
transactions = account.get_transactions(date_from="2021-12-01", date_to="2022-01-21")

Premium endpoints

# Get premium transactions. Country and date parameters are optional
premium_transactions = account.get_premium_transactions(
    country="LV",
    date_from="2021-12-01",
    date_to="2022-01-21"
)
# Get premium details
premium_details = account.get_premium_details()

Support

For any inquiries please contact support at bank-account-data-support@gocardless.com or create an issue in repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nordigen-1.4.2.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nordigen-1.4.2-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file nordigen-1.4.2.tar.gz.

File metadata

  • Download URL: nordigen-1.4.2.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.19

File hashes

Hashes for nordigen-1.4.2.tar.gz
Algorithm Hash digest
SHA256 8b82338ab0604254dd428b0b37aae999c090e7305266cffbe4e219f7bd3acf79
MD5 6a69207892c54d1dfa5705d14fa2b49f
BLAKE2b-256 fde52f43f61d3b3d69af6c62b6beefbe6a3cc79c5b8de477122e3fff9884d41a

See more details on using hashes here.

File details

Details for the file nordigen-1.4.2-py3-none-any.whl.

File metadata

  • Download URL: nordigen-1.4.2-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.19

File hashes

Hashes for nordigen-1.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5087503b1fa486044fc3ce291d0be580ed204c7b9fcb5b85dc0646c7280bf29d
MD5 e490c377d08283f407212c305b5578e3
BLAKE2b-256 bc14a4bbe701e0002a7870c165768d970e35af80c04412517a2a1fd03d011ee4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page