This document explains the flow of events related to the Confirmation of Funds Service that a Payment Instrument Issuer Service Providers (PIISP) tries. For the Berlin specific solution, the Confirmation of Funds Service is exposed as an API resource in NextGenPSD2XS2AFramework of WSO2 Open Banking. In the Confirmation of Funds Service, a PIISP can confirm the availability of funds for a specific amount in a given account owned by a Payment Services User (PSU).
You can try out the Confirmation of Funds Service flow in WSO2 Open Banking using the following steps:
Step 1 - Sign up as a TPP
In this step, the TPP registers its TPP application in the WSO2 Open Banking Developer portal.
Click here to see how it is done...
Navigate to the WSO2 Open Banking Developer portal at https://<WSO2_OB_APIM_HOST>:9443/devportal
.
- Select Applications in the menu.
- In the Sign-in form, click Create Account.
- Provide a username and click Proceed Self Register.
Fill the Create New Account form to complete registration.
Read terms and conditions. Click the checkbox to agree to the terms and conditions.
Click Register.
Step 2 - Sign in to the Developer Portal as the TPP
Users can sign in to WSO2 Open Banking Developer portal with the authentication details created during sign up.
Click here to see how it is done...
Sign in to the Developer portal as the TPP at https://<WSO2_OB_APIM_HOST>:9443/devportal
.
- Enter the username and the password you entered when signing up as a TPP.
Click Continue.
The homepage of the Developer Portal is now displayed along with the published APIs.
Step 3 - Create an application
The TPP with a CBPII application needs to create an application using WSO2 Open Banking Developer portal. The application created via the Developer portal allows to observe statistics of APIs, subscribe to APIs, and access the subscribed APIs.
Click here to see how it is done...
Go to the Applications tab in the Developer Portal.
Click ADD NEW APPLICATION.
Enter application details.
Click SAVE.
Step 4 - Subscribe to API
The TPP user needs to subscribe to the NextGen PSD2 XS2A Framework API in order to access the API resources. Once subscribed, the users can access all the supported services of the API resources.
Click here to see how it is done...
Go to the APIs tab in the Developer portal.
Select the NextGenPSD2XS2A Framework API.
- Go to Subscriptions at the bottom of the API and select SUBSCRIBE.
- Select an Application from the drop-down list, set the Throttling Policy and click SUBSCRIBE.
Once you subscribe, you can find the list of subscriptions in the bottom.
Now that you have subscribed to the API, generate access tokens and invoke the API.
Step 5 - Create and upload certificates
The TPP user needs to create certificates to validate whether the TPP is registered in a governing entity. It is verified in the TPP Onboarding process. eIDAS root certificates obtained from the Qualified Trust Service Providers must be added to the client trust stores of the WSO2 Open Banking Identity and Access Management and WSO2 Open Banking API Management modules. For testing purposes, create a self-signed root certificate following the instructions given below:
Click here to see a self-signed certificate is created...
A keystore file is used to store the trusted certificates of the TPP in the WSO2 Open Banking solution. Use the commands given below in a command-line interface in order to create a keystore file as a TPP.
Make sure to update the following placeholders:
<alias> | A preferred alias for the keystore file. |
---|
<filename> | A preferred name for the keystore file. |
---|
keytool -genkey -alias <alias> -keyalg RSA -keystore <filename>.jks
During the command execution, the TPP user requires to;
- Set a password for the keystore.
- Provide information, acquired when registering with a governing entity.
- Set a password for user-defined alias (<alias>).
Convert the keystore from the .jks format to .PKCS12. Make sure to update the following placeholders:
<keyStoreName> | This is the name of the <filename> , given above. |
---|
<PKCS12FileName> | This is the name of the keystore in the .PKCS12 format. |
---|
keytool -importkeystore -srckeystore <keystoreStoreName>.jks -destkeystore <PKCS12FileName>.p12 -deststoretype PKCS12
During the command execution, the TPP user requires to;
- Set a password for the destination keystore.
- Enter the source keystore password, as defined in the above step .
Create the application certificate (.pem) file in the PKCS12 format using the keystore. e.g: tpp.p12.
Make sure to update the following placeholders:
<PKCS12FileName> | This is the name of the keystore in the PKCS12 format, as mentioned above for the <PKCS12FileName>. |
---|
<PEMFileName> | This is the name of the application certificate that is created in the .pem format. |
---|
openssl pkcs12 -in <PKCS12FileName>.p12 -nokeys -out <PEMFileName>.pem
During the command execution, the TPP user requires to;
- Set a password to import the .pem file.
Once you create a self-signed root certificate, upload it to the client trust stores of WSO2 OB APIM and WSO2 OB IAM.
Step 6 - Generate keys
The TPP user requires a Client ID (Consumer Key) to access the subscribed APIs.
Click here to see how it is done...
Sign in to WSO2 Open Banking Developer portal as a TPP user.
Go to the Applications tab and select the application you used to subscribe to the NextGen PSD2 Framework API.
- Scroll down and select either of the following types of keys:
Production Keys: Generates access tokens in the production environment.
Sandbox Keys: Generates access tokens in the sandbox environment.
- Click Manage at the bottom of the page.
Provide the requested information as defined below:
Field | Description |
---|
Grant Types | These determine the credentials that are used to generate the access token. - Code: This relates to the authorisation code grant type and is applicable when consuming the API as a user.
- Implicit: This is similar to the code grant type, but instead of generating code, this directly provides the access token.
- Refresh Token: This is to renew an expired access token.
- Client Credential: This relates to the client credentials grant type and is applicable when consuming the API as an application.
|
Callback URL | This is the URL used by the TPP to receive the authorisation code sent from the Account Servicing Payment Service Provider (ASPSP), e.g: bank. The authorisation code can be used later to generate an OAuth2 access token. |
Application Certificate | This is the content between the BEGIN CERTIFICATE and END CERTIFICATE strings of the application certificate (.PEM). |
Organization ID | The Organization Identifier as provided in the eIDAS certificate. For example. PSDUK-NCA-OrganizationID |
Click GENERATE KEYS to generate production or sandbox keys. It generates consumer key and consumer secret.
Step 7 - Generate application access token
When invoking APIs in the NextGenPSD2XS2A framework, application access tokens must be generated using the client credential grant type. The generated application access token is used to invoke the API.
Click here to see how it is done...
Once the client is successfully registered, sign in to WSO2 Open Banking Developer Portal and go to the Applications tab.
Select your client application from the Application List.
You can view the keys you generated at the bottom of this page:
The Consumer Key shown above is the client ID of your application.
Now, generate the client assertion by signing the following JSON payload using the supported algorithms.
Run the following cURL command in a command prompt to generate the access token. Update the placeholders with the relevant values.
curl -X POST \
https://<WSO2_OB_APIM_HOST>:8243/token \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--cert <PUBLIC_KEY_FILE_PATH> --key <PRIVATE_KEY_FILE_PATH> \
-d 'client_id=<CLIENT_ID>&grant_type=client_credentials&scope=fundsconfirmations+openid&client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer&client_assertion=<CLIENT_ASSERTION_JWT>&redirect_uri=<APPLICATION_CALLBACK_URL>'
The access token is now generated.
Step 8 - Initiate funds confirmation consents
In this step, the TPP creates a request to get the consent of the PSU to access the accounts and its information from the bank. The Bank sends the request to the PSU stating the accounts and information that the TPP wishes to access. Upon the user approving or denying the account consent, the TPP is now eligible to access the user's account details.
Click here to see how it is done...
In this step, the TPP creates a request to get the consent of the PSU to confirm the funds available in the bank account. The Bank sends the request to the PSU stating the accounts and information that the TPP wants to access. Upon the user approving or denying the account consent, the TPP is then eligible to access to confirm funds are available.
Step 9 - Initiate an authorisation flow for a funds confirmation consent
The authorisation flow consists of the following steps.
- ASPSP creates authorization sub-resources after the funds confirmation consent is received
- ASPSP replies with the well-known configuration of the Identity and Access Management module in the links section of the response
- TPP generates the authorization URL using the well-known URL
- PSU goes through the authorisation flow with that authorisation URL
Authorisation URL
The TPP uses the well-known URL to authorise a consent as explained below:
Click here to see how it is done...
The open banking solution sends the authorisation URL that was generated under scaOAuth
link of the response. A sample well-known URL under scaOAuth
parameter looks as follows:
{
"scaOAuth":{
"href":"https://<WSO2_OB_APIM_HOST>:8243/.well-known/openid-configuration"
}
}
Paste the authorisation URL in the web browser. The format for the authorisation URL looks as follows:
Use the following table to find the descriptions for the parameters:
Parameter | Description |
---|
scope
| This is the reference to the consent resource for account access. It is in the form of ais:<consentId> |
response_type | code is recommended. |
redirect_uri | The TPP's URI that the OAuth2 server redirects the PSU's user agent after the authorisation. |
state | Prevents XSRF attacks by TPP setting a dynamic value. |
code_challenge_method
| Code verifier transformation method. It is recommended in the Berlin specification to use S256. |
client_id | As provided in the eIDAS certificate, the organization_Identifier must contain the following information in it: - "PSD" as 3 character legal person identity type reference - 2 character ISO 3166 country code representing the NCA country - hyphen-minus "-" and - 2-8 character NCA identifier (A-Z uppercase only, no separator - hyphen-minus "-" - PSP identifier (authorization number as specified by NCA) |
code_challenge
| This is used to avoid code injection attacks using the PKCE challenge in the cryptographic RFC 7636. Go to https://tools.ietf.org/html/rfc7636 for more information on the cryptographic RFC 7636. |
The authorisation URL points to the Consent page.
Upon the user approving or denying the account consent, the user can invoke consent/authorization
API resource of the authentication endpoint. By invoking this API resource, the user retrieves the consent approval/denial, that is displayed on the consent web-app.
Step 10 - Generate user access token
The TPP must obtain a user access token to invoke the APIs in the Confirmation of Funds Service.
Click here to see how it is done...
The client_assertion is a JSON Web Token (JWT). Generate the client_assertion by signing the following JSON payload using the supported algorithms:
Run the following cURL command in a command prompt to generate the access token as a TPP user.
POST /funds-confirmations
This API is to confirm the availability of funds for the specified account of the PSU.