Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions python/account_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
CLIENT_SECRET = 'your client secret here'

if __name__ == '__main__':
account_id = 'FI6593857450293470-EUR' # try changing this
endpoint = 'v2/accounts/{}'.format(account_id)
account_id = 'DK20301544117544-DKK' # try changing this
endpoint = 'v3/accounts/{}'.format(account_id)
access_token = generate_access_token()
headers = {
'X-IBM-Client-Id': CLIENT_ID,
Expand Down
21 changes: 14 additions & 7 deletions python/generate_access_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
API_URI = 'https://api.nordeaopenbanking.com/'
CLIENT_ID = 'your client id here'
CLIENT_SECRET = 'your client secret here'
REDIRECT_URI = 'http://httpbin.org/get'
REDIRECT_URI = 'http://httpbin.org/'

"""
This is an example how to generate the access token from the scratch.
Expand All @@ -14,11 +14,14 @@
"""

def get_code():
endpoint = 'v1/authentication'
endpoint = 'v3/authorize'
payload = {
'client_id': CLIENT_ID,
'redirect_uri': REDIRECT_URI,
'state': ''
'redirect_uri': REDIRECT_URI + "anything",
'state': 'oauth2',
'scope': 'ACCOUNTS_BASIC,ACCOUNTS_BALANCES,ACCOUNTS_DETAILS,ACCOUNTS_TRANSACTIONS,PAYMENTS_MULTIPLE',
'duration': '1234',
'country': 'DK'
}
r = requests.get(API_URI + endpoint, params=payload)
if not r.status_code == requests.codes.ok:
Expand All @@ -29,17 +32,21 @@ def get_code():


def get_access_token(code):
endpoint = 'v1/authentication/access_token'
endpoint = 'v3/authorize/token'
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'X-IBM-Client-Id': CLIENT_ID,
'X-IBM-Client-Secret': CLIENT_SECRET
'X-IBM-Client-Secret': CLIENT_SECRET,
'cache-control' : "no-cache",
'Accept':'application/json'
}

payload = {
'code': code,
'redirect_uri': REDIRECT_URI
'redirect_uri': REDIRECT_URI + "anything",
'grant_type': 'authorization_code'
}

r = requests.post(API_URI + endpoint, data=payload, headers=headers)
if not r.status_code == requests.codes.ok:
raise Exception(r.text)
Expand Down
3 changes: 2 additions & 1 deletion python/get_payments.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
CLIENT_SECRET = 'your client secret here'

if __name__ == '__main__':
endpoint = 'v2/payments/sepa/'
account_id = 'DK20301544117544-DKK' # try changing this
endpoint = 'v3/accounts/{}/transactions'.format(account_id)
access_token = generate_access_token()
headers = {
'X-IBM-Client-Id': CLIENT_ID,
Expand Down
44 changes: 26 additions & 18 deletions python/initiate_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
CLIENT_SECRET = 'your client secret here'

if __name__ == '__main__':
endpoint = 'v2/payments/sepa'
endpoint = 'v3/payments/domestic'
access_token = generate_access_token()
headers = {
'X-IBM-Client-Id': CLIENT_ID,
Expand All @@ -17,31 +17,39 @@
'X-Response-Scenarios': 'AuthorizationSkipAccessControl',
'content-type': 'application/json'
}

payload = {
"amount": "621000.45",
"creditor": {
"account": {
"_type": "IBAN",
"value": "FI1350001520000081"
},
"message": "This is a message, 123!",
"name": "Beneficiary name",
"reference": {
"_type": "RF",
"value": "RF18539007547034"
}
},
"currency": "EUR",
"debtor": {
"_accountId": "FI6593857450293470-EUR"
}
"amount" : "100.12",
"currency" : "DKK",
"debtor" : {
"account" : {
"value" : "DK6120301544118028",
"_type" : "IBAN",
"currency" : "DKK"
}
},
"creditor" : {
"account" : {
"currency": "DKK",
"value" : "DK3420301544117544",
"_type" : "IBAN"
},
"name" : "Creditor name",
"message" : "wow",
"reference" : {
"value" : "RF11223344",
"_type" : "RF"
}
}
}
r = requests.post(API_URI + endpoint, headers=headers,
data=json.dumps(payload))

if not r.status_code == requests.codes.created:
raise Exception(r.text)
response = r.json()
payment_id = response['response']['_id']

# print the payment id
print(payment_id)

Expand Down
2 changes: 1 addition & 1 deletion python/list_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# get valid access token
access_token = generate_access_token()
# endpoint we query
endpoint = 'v2/accounts'
endpoint = 'v3/accounts'
# set headers and make the request
headers = {
'X-IBM-Client-Id': CLIENT_ID,
Expand Down
Empty file added wow.txt
Empty file.