{"id":23261034,"url":"https://github.com/truelayer/truelayer-java","last_synced_at":"2025-08-20T16:34:26.464Z","repository":{"id":37088222,"uuid":"424165560","full_name":"TrueLayer/truelayer-java","owner":"TrueLayer","description":"The official TrueLayer Java library provides convenient access to TrueLayer APIs from applications built with Java.","archived":false,"fork":false,"pushed_at":"2024-04-18T04:24:19.000Z","size":1864,"stargazers_count":7,"open_issues_count":4,"forks_count":9,"subscribers_count":17,"default_branch":"main","last_synced_at":"2024-04-24T03:54:08.083Z","etag":null,"topics":["java-sdk","payments"],"latest_commit_sha":null,"homepage":"https://docs.truelayer.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TrueLayer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-03T09:39:31.000Z","updated_at":"2024-08-05T11:00:34.170Z","dependencies_parsed_at":"2023-10-12T19:42:24.782Z","dependency_job_id":"cfbe2f00-77cd-4f22-acf8-742adbd8be0d","html_url":"https://github.com/TrueLayer/truelayer-java","commit_stats":null,"previous_names":[],"tags_count":183,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrueLayer%2Ftruelayer-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrueLayer%2Ftruelayer-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrueLayer%2Ftruelayer-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrueLayer%2Ftruelayer-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TrueLayer","download_url":"https://codeload.github.com/TrueLayer/truelayer-java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230441185,"owners_count":18226342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java-sdk","payments"],"created_at":"2024-12-19T13:28:50.579Z","updated_at":"2025-08-20T16:34:26.450Z","avatar_url":"https://github.com/TrueLayer.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TrueLayer Java\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.truelayer/truelayer-java/badge.svg?style=flat)](https://search.maven.org/artifact/com.truelayer/truelayer-java)\n[![javadoc](https://javadoc.io/badge2/com.truelayer/truelayer-java/javadoc.svg)](https://javadoc.io/doc/com.truelayer/truelayer-java)\n[![Coverage Status](https://coveralls.io/repos/github/TrueLayer/truelayer-java/badge.svg?t=gcGKQv)](https://coveralls.io/github/TrueLayer/truelayer-java)\n[![Scheduled acceptance tests in Sandbox environment](https://github.com/TrueLayer/truelayer-java/actions/workflows/workflow-scheduled-acceptance-tests.yml/badge.svg)](https://github.com/TrueLayer/truelayer-java/actions/workflows/workflow-scheduled-acceptance-tests.yml)\n[![License](https://img.shields.io/:license-mit-blue.svg)](https://truelayer.mit-license.org/)\n\nThe official [TrueLayer](https://truelayer.com) Java client provides convenient access to TrueLayer APIs from applications built with Java. \n\n## Installation\n\n### Stable releases\n\nOur stable releases are hosted on [Maven Central](https://search.maven.org/artifact/com.truelayer/truelayer-java).\n\nAs such, it's enough to simply declare the desired `truelayer-java` artifact dependency\n:\n\n```gradle\ndependencies {\n    // ... your existing dependencies\n\n    // TL Java BE library\n    implementation 'com.truelayer:truelayer-java:$version'\n}\n```\n\nTo know more about our final releases please see our [Releases](https://github.com/TrueLayer/truelayer-java/releases) section.\n\n### Unstable releases\n\nUnstable releases are published as `SNAPSHOT` releases on the Nexus Sonatype repository. \n\nTo use on of those release with Gradle, make sure you have the following repository listed in your build.gradle file: \n```gradle\nrepositories {\n    // ... all your existing repos here\n    \n    maven {\n        url = 'https://central.sonatype.com/repository/maven-snapshots/'\n    }\n}\n``` \n\nAnd you declare a dependency with a `-SNAPSHOT` suffix:\n\n```gradle\ndependencies {\n    // ... your existing dependencies\n\n    // TL Java BE library\n    implementation 'com.truelayer:truelayer-java:$version-$featureName-SNAPSHOT'\n}\n```\n\nA sample snapshot artifact would be `com.truelayer:truelayer-java:0.4.10-jsdk-9-SNAPSHOT`, \nwhere `0.4.10` represents the future final version of the library and `jsdk-9` is the\nbranch name on which the new feature is being implemented.\n\nThere can be multiple artifacts available for a given snapshot. Gradle will automatically look for the latest one.\n\n## Documentation\n\nCheck out the [API documentation](https://docs.truelayer.com) and [Java library documentation](https://javadoc.io/doc/com.truelayer/truelayer-java/latest/index.html).\n\n## Usage\n\n### Prerequisites\n\nBefore using the Java library you need a developer account and a signing key pair as explained [here](https://docs.truelayer.com/docs/sign-your-requests#step-1-generate-a-signing-key-pair).\n\n### Initialize TrueLayerClient\n```java\nTrueLayerClient client = TrueLayerClient.New()\n        .environment(Environment.sandbox()) // optional: to use TL sandbox environment\n        .withHttpLogs() // optional: logs HTTP traces to stdout\n        .clientCredentials(\n                ClientCredentials.builder()\n                        .clientId(\"a-client-id\")\n                        .clientSecret(\"a-secret\").build())\n        .signingOptions(\n                SigningOptions.builder()\n                        .keyId(\"a-key-id\")\n                        .privateKey(Files.readAllBytes(Path.of(\"my-private-key.pem\")))\n                        .build())\n        .build();\n```\n\nMore details about our logs can be found [on our wiki](https://github.com/TrueLayer/truelayer-java/wiki/Logging).\n\n### Create a payment\n```java\n// build the payment request object\nCreatePaymentRequest paymentRequest = CreatePaymentRequest.builder()\n        .amountInMinor(101)\n        .currency(CurrencyCode.GBP)\n        .paymentMethod(PaymentMethod.bankTransfer()\n            .providerSelection(ProviderSelection.userSelected()\n                    .filter(ProviderFilter.builder()\n                    .countries(Collections.singletonList(CountryCode.GB))\n                    .releaseChannel(ReleaseChannel.GENERAL_AVAILABILITY)\n                    .customerSegments(Collections.singletonList(CustomerSegment.RETAIL))\n                    .providerIds(Collections.singletonList(\"mock-payments-gb-redirect\"))\n                    .build())\n                .build())\n            .beneficiary(MerchantAccount.builder()\n                .merchantAccountId(\"e83c4c20-b2ad-4b73-8a32-ee855362d72a\")\n                .build())\n            .build())\n        .user(User.builder()\n            .name(\"Andrea\")\n            .email(\"andrea@truelayer.com\")\n            .build())\n        .build();        \n\n// fire the request        \nCompletableFuture\u003cApiResponse\u003cCreatePaymentResponse\u003e\u003e paymentResponse = client\n    .payments()\n    .createPayment(paymentRequest);\n\n// wait for the response\nApiResponse\u003cCreatePaymentResponse\u003e payment = paymentResponse.get();\n```\n\n### Build a link to our Hosted Payment Page (HPP)\n\nBy default, the Hosted Payment Page link builder creates a payment result page, so you can just pass \na `resource_id`, a `resource_token` and `return_uri` parameters:\n```java\nURI link = client.hppLinkBuilder()\n        .resourceType(ResourceType.PAYMENT) // Either PAYMENT or MANDATE. Not mandatory, if not specified PAYMENT is used as default\n        .resourceId(\"$resourceId\")\n        .resourceToken(\"$resourceToken\")\n        .returnUri(URI.create(\"http://yourdomain.com\"))\n        .build();\n```\nIf needed, you can specify extra parameters as per our [public documentation](https://docs.truelayer.com/docs/authorise-payments-or-mandates-with-the-hpp#1-build-a-hpp-url),\nlike `max_wait_for_result` and `signup`:\n\n```java\nURI link = client.hppLinkBuilder()\n        .resourceType(ResourceType.MANDATE)\n        .resourceId(\"$resourceId\")\n        .resourceToken(\"$resourceToken\")\n        .returnUri(URI.create(\"http://yourdomain.com\"))\n        .maxWaitForResultSeconds(15)\n        .signup(true)\n        .build();\n```\n\n## Local setup\n\nAny version of the JDK \u003e= 8 supported by Gradle can build and run this package.\nCheck the [Gradle compatibility matrix](https://docs.gradle.org/current/userguide/compatibility.html) for more info.\n\n\u003e [!IMPORTANT]  \n\u003e To ensure compatibility, Gradle is configured to use the Java 8 toolchain by default.  \n\u003e Note that on M1 Macs, Gradle is unable to download this toolchain automatically and returns the following error:\n\u003e `Could not read 'https: //api.adoptopenidk.net/v3/binary/latest/8/ga/mac/aarch64/idk/hotspot/normal/adoptopenidk' as it does not exist.`.\n\u003e \n\u003e Manually install an aarch64 version of the JDK 1.8 to solve it, like the \"Azul Zulu 1.8\" for example.\n\n\u003e [!TIP]\n\u003e We use [just](https://github.com/casey/just) to simplify commands management when building locally. Run `just -l` for a list of recipes.\n\n## Building locally\n\nTo build the solution run:\n```sh\n./gradlew build\n```\n\n## Testing\n### Unit tests\n\nTo run unit tests: \n```sh\n./gradlew unit-tests\n```\n\n### Integration tests\n\nTo run integration tests:\n```sh\n./gradlew integration-tests\n```\n\n### Acceptance tests\n\nTo execute tests against TrueLayer sandbox environment, you should set the below environment variables:\n- `TL_CLIENT_ID`\n- `TL_CLIENT_SECRET`\n- `TL_SIGNING_KEY_ID`\n- `TL_SIGNING_PRIVATE_KEY`\n\nand finally run:\n```sh\n./gradlew acceptance-tests\n```\n## Code linting\nTo enforce coding style guidelines the project uses [palantir-java-format styles via Spotless gradle plugin](https://github.com/diffplug/spotless/tree/main/plugin-gradle#palantir-java-format).\n\n\nTo locally check that your sources comply with our formatting\n```sh\n./gradlew spotlessJavaCheck\n```\n\nTo appy the changes suggested - if any\n```sh\n./gradlew spotlessApply\n```\n\nBear in mind that the above checks are enforced at CI time, thus \nthe builds will fail if not compliant.\n\nWhen developing on IntelliJ you can optionally install this [Spotless IntelliJ Gradle plugin](https://github.com/ragurney/spotless-intellij-gradle) as well.\n\nDue to an open issue with JDK16+, we had to specify some extra Jvm options in the [gradle.properties](gradle.properties) file.\nIf you're building on JDK versions below 9, you'll have to remove/comment the `org.gradle.jvmargs` key in there.\n\n## Contributing\n\nContributions are always welcome!\n\nSee our [contributing guide](./CONTRIBUTING.md).\n\nPlease adhere to this project's [code of conduct](CODE_OF_CONDUCT.md).\n  \n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruelayer%2Ftruelayer-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftruelayer%2Ftruelayer-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruelayer%2Ftruelayer-java/lists"}