🏦 Java client for using the UK Open Banking API
Java client for using the Open Banking API, exposed by an ASPSP, as a TPP. The library supports a subset of the full API:
- Support for version 3.2 dynamic client registration
- Support for version 3.1.6 single immediate domestic payments
- Support for version 3.1.9 variable recurring payments API
- Support for the following OAuth client authentication methods
- Mutual TLS
- Private key JWT
- Client secret basic
- Client secret post
//
// Step 1 - configure the RegistrationClient instance to use for the ASPSP
//
TppConfiguration tppConfiguration = TppConfiguration.builder()
// set the properties acording to your organisation
.build();
// configure the SSL context of the instance according to your setup, including a KeyManager to support mutual TLS on
// conections to ASPSP and a TrustManager to support connections to ASPSPs using OB issued certificates
RestTemplate restTemplate = new RestTemplate();
// an example implementation might look up the values to supply from a KeyStore
KeySupplier signingKeySupplier = new ExampleKeySupplier();
JsonConverter jsonConverter = new JacksonJsonConverter();
JwtClaimsSigner jwtClaimsSigner = new JwtClaimsSigner(signingKeySupplier, jsonConverter);
RegistrationClient registrationClient = new RestRegistrationClient(jwtClaimsSigner, restTemplate);
RegistrationRequestService registrationRequestService = new RegistrationRequestService(keySupplier, tppConfiguration);
// supplies the details of the ASPSP implementation required to make the API calls
AspspDetails aspspDetails = new ExampleAspspDetails();
//
// Step 2 - register with the ASPSP
//
ClientRegistrationRequest clientRegistrationRequest = registrationRequestService.generateRegistrationRequest(
softwareStatement,
aspspDetails);
ClientRegistrationResponse clientRegistrationResponse = registrationClient.registerClient(clientRegistrationRequest,
aspspDetails);
//
// Step 1 - configure the V3 PaymentClient instance to use for the ASPSP
//
TppConfiguration tppConfiguration = TppConfiguration.builder()
// set the properties acording to your organisation
.build();
// configure the SSL context of the instance according to your setup, including a KeyManager to support mutual TLS on
// conections to ASPSP and a TrustManager to support connections to ASPSPs using OB issued certificates
RestTemplate restTemplate = new RestTemplate();
ClientAuthentication tlsClientAuthentication = new TlsAuthentication();
OAuthClient restOAuthClient = new RestOAuthClient(tlsClientAuthentication, restTemplate);
// an example implementation might use the EndToEndIdentification of the request as the idempotency key
IdempotencyKeyGenerator idempotencyKeyGenerator = new ExampleIdempotencyKeyGenerator();
// an example implementation might look up the values to supply from a KeyStore
KeySupplier signingKeySupplier = new ExampleKeySupplier();
JsonConverter jsonConverter = new JacksonJsonConverter();
JwtClaimsSigner jwtClaimsSigner = new JwtClaimsSigner(signingKeySupplier, jsonConverter);
PaymentClient paymentClient = new RestPaymentClient(restTemplate,
jsonConverter,
restOAuthClient,
idempotencyKeyGenerator,
jwtClaimsSigner);
// supplies the details of the ASPSP implementation required to make the API calls
AspspDetails aspspDetails = new ExampleAspspDetails();
//
// Step 2 - initiate the payment
//
// set the properties according to the payment attempt
OBWriteDomesticConsent4 paymentConsentRequest = new OBWriteDomesticConsent4();
OBWriteDomesticConsentResponse5 paymentConsentResponse = paymentClient.createDomesticPaymentConsent(
paymentConsentRequest,
aspspDetails);
//
// Step 3 - redirect the user to the ASPSP authorisation site to authorise the payment
//
// on authorisation success, an authorization code is received from the ASPSP
// note, when building the ASPSP authorisation URL, the JwtClaimsSigner can be used to generate the request parameter
//
//
// Step 4 - submit the payment for execution
//
//
// Step 4a (optional) - check for sufficient funds on the source account
//
OBWriteFundsConfirmationResponse1 fundsConfirmationResponse = paymentClient.getFundsConfirmation(consentId,
authorizationCode,
aspspDetails);
// set the properties according to the payment attempt
OBWriteDomestic2 paymentRequest = new OBWriteDomestic2();
OBWriteDomesticResponse5 paymentResponse = paymentClient.createDomesticPayment(paymentRequest,
authorizationCode,
aspspDetails);
- Prepare a PR for review (all commits must be signed)
- We receive a notification and review your PR
- We merge approved PR and release a new version
- Generate a GPG key
- Upload your GPG public key to your GitHub account
- Configure Git to use your GPG key
Copyright 2023 Exohood Labs.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.