• Stars
    star
    129
  • Rank 279,262 (Top 6 %)
  • Language
    Java
  • License
    MIT License
  • Created over 10 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Java bindings for Plaid

plaid-java Circle CI Maven Central

Java Bindings for the Plaid API (https://www.plaid.com/docs). This library is generated from the Plaid OpenAPI spec.

Plaid API is defined in the PlaidApi interface.

Check the Junit test classes for examples of more use cases. Every API endpoint has at least one integration test against the sandbox environment.

Uses Retrofit and OkHttp under the hood. You may want to take a look at those libraries if you need to do anything out of the ordinary.

Installation

Plaid-java is available at Maven Central

<dependency>
  <groupId>com.plaid</groupId>
  <artifactId>plaid-java</artifactId>
  <version>9.0.0</version>
</dependency>

Versioning

As of 9.0.0, the library is generated from the OpenAPI spec. Previous versions were written manually and should still mostly work, but may not support newer functionality. Here's a link to 8.5.0, the latest pre-generated version.

Each major version of plaid-java targets a specific version of the Plaid API:

API version plaid-java release
2020-09-14 (latest) 8.x.x and higher
2019-05-29 7.x.x
2018-05-22 4.x.x (and 3.x.x)
2017-03-08 2.x.x

For information about what has changed between versions and how to update your integration, head to the version changelog.

The plaid-java client library is typically updated on a monthly basis. The canonical source for the latest version number is the client library changelog.

Data type differences from API and from previous versions

Dates

Dates and datetimes in requests, which are represented as strings in the API and in previous client library versions, are represented in this version of the Java client library as LocalDate or OffsetDateTime objects.

Time zone information is required for request fields that accept datetimes. Failing to include time zone information (or specifying a string, instead of an OffsetDateTime object) will result in an error.

If the API reference documentation for a request field specifies format: date, the following is acceptable:

import java.time.LocalDate;

LocalDate myDate = LocalDate.parse("2019-12-06");

If the API reference documentation for a request field specifies format: date-time, the following is acceptable:

import java.time.OffsetDateTime;

OffsetDateTime myDateTime = OffsetDateTime.parse("2019-12-06T22:35:49+00:00");

Enums

While the API represents enums using strings, and previous library versions used singletons, this current library uses enum types.

Old:

LinkTokenCreateRequest request = new LinkTokenCreateRequest(
   Collections.singletonList("auth"))
  .withCountryCodes(Collections.singletonList("US"))
...

Current:

LinkTokenCreateRequest request = new LinkTokenCreateRequest()
  .products(Arrays.asList(Products.AUTH))
  .countryCodes(Arrays.asList(CountryCode.US))
  ...

Basic Usage

private PlaidApi plaidClient;

HashMap<String, String> apiKeys = new HashMap<String, String>();
apiKeys.put("clientId", plaidClientId);
apiKeys.put("secret", plaidSecret);
apiClient = new ApiClient(apiKeys);
apiClient.setPlaidAdapter(ApiClient.Sandbox); // or equivalent, depending on which environment you're calling into
plaidClient = apiClient.createService(PlaidApi.class);

// Synchronously exchange a Link public_token for an API access_token
// Required request parameters are always Request object constructor arguments
ItemPublicTokenExchangeRequest request = new ItemPublicTokenExchangeRequest().publicToken("the_link_public_token");
Response<ItemPublicTokenExchangeResponse> response = plaidClient()
    .itemPublicTokenExchange(request).execute();

if (response.isSuccessful()) {
  accessToken = response.body().getAccessToken();
}


// Asynchronously do the same thing. Useful for potentially long-lived calls.
ItemPublicTokenExchangeRequest request = new ItemPublicTokenExchangeRequest().publicToken(publicToken);
plaidClient()
    .itemPublicTokenExchange(request)
    .enqueue(new Callback<ItemPublicTokenExchangeResponse>() {
        @Override
        public void onResponse(Call<ItemPublicTokenExchangeResponse> call, Response<ItemPublicTokenExchangeResponse> response) {
          if (response.isSuccessful()) {
            accessToken = response.body.getAccessToken();
          }
        }

        @Override
        public void onFailure(Call<ItemPublicTokenExchangeResponse> call, Throwable t) {
          // handle the failure as needed
        }
    });


// Decoding an unsuccessful response
try {
  Gson gson = new Gson();
  PlaidError error = gson.fromJson(response.errorBody().string(), PlaidError.class);
} catch (Exception e) {
  throw new Exception(
    String.format(
      "Failed converting from API Response Error Body to Error %f",
      response.errorBody().string()
    )
  );
}

Legacy API

If you're looking for a Java client that works with the legacy Plaid API, use versions of plaid-java before 2.1.0. The API and client are not backwards-compatible.

More Repositories

1

quickstart

Get up and running with Plaid Link and the API in minutes
TypeScript
537
star
2

plaid-node

Node bindings for Plaid
TypeScript
521
star
3

pattern

An example end-to-end Plaid integration to create items and fetch transaction data
TypeScript
441
star
4

plaid-python

Python bindings for Plaid
Python
426
star
5

plaid-postman

Postman collection for the Plaid API
HTML
315
star
6

react-plaid-link

React bindings for Plaid Link
TypeScript
264
star
7

deprecated-link

This repository is now deprecated. To integrate with Plaid, visit the docs.
261
star
8

plaid-ruby

Ruby bindings for Plaid
Ruby
225
star
9

plaid-go

go bindings for Plaid
Go
196
star
10

deprecated-async-problem

🔀 Solutions and non-solutions to JavaScript's async problem
JavaScript
186
star
11

react-native-plaid-link-sdk

Plaid Link for React Native
TypeScript
170
star
12

plaid-link-ios

Plaid Link iOS SDK
Objective-C
116
star
13

plaid-link-android

Plaid Link Android SDK
Kotlin
100
star
14

tiny-quickstart

A minimal quickstart demonstrating Plaid Link, Balances, and OAuth
JavaScript
77
star
15

plaid-openapi

API version 2020-09-14
74
star
16

support

Plaid Support
66
star
17

plaid-link-examples

Plaid Link Webview, ReactNative examples
Objective-C
60
star
18

pattern-account-funding

Sample code to demonstrate Plaid-powered account funding use cases using the Auth, Identity, and Balance APIs. Includes examples of using Auth partners for end-to-end funds transfers.
TypeScript
44
star
19

envvar

Derive JavaScript values from environment variables
JavaScript
37
star
20

npmserve

fast npm installs for slow clients
Shell
36
star
21

npmserve-server

fast npm installs for slow clients
JavaScript
27
star
22

go-envvar

A go library for managing environment variables. Maps to typed values, supports required and optional vars with defaults.
Go
25
star
23

idv-quickstart

Get up and running with Plaid Identity Verification in minutes
CSS
22
star
24

tutorial-resources

Sample apps and material to go along with Plaid's tutorials
JavaScript
18
star
25

income-sample

Sample app for Income
TypeScript
15
star
26

account-funding-tutorial

TypeScript
13
star
27

sandbox-custom-users

JSON files specifying custom users suitable for testing Plaid integrations on Sandbox
Python
13
star
28

nockingbird

Declarative HTTP mocking (for use with Nock)
CoffeeScript
13
star
29

core-exchange

The Core Exchange spec and generated server code
JavaScript
12
star
30

pattern-transfers

TypeScript
11
star
31

payment-initiation-pattern-app

Payment Initiation demo app for Europe, based on Plaid Pattern
TypeScript
6
star
32

credit-attributes

Attributes that can be calculated using Plaid's credit products
Python
4
star
33

plaid-node-legacy

⚠️This library has been deprecated and archived. Our current libraries can be found at https://plaid.com/docs/libraries/ or https://github.com/plaid
JavaScript
4
star
34

assets-attributes

Attributes that can be calculated using a Plaid Asset Report
Python
3
star
35

plaid-java-legacy

⚠️This library has been deprecated and archived. Our current libraries can be found at https://plaid.com/docs/libraries/ or https://github.com/plaid
Java
3
star
36

plaid-python-legacy

⚠️This library has been deprecated and archived. Our current libraries can be found at https://plaid.com/docs/libraries/ or https://github.com/plaid
Python
3
star
37

plaid-ruby-legacy

⚠️This library has been deprecated and archived. Our current libraries can be found at https://plaid.com/docs/libraries/ or https://github.com/plaid
Ruby
2
star
38

.github

1
star
39

plaid-go-legacy

⚠️This library has been deprecated and archived. Our current libraries can be found at https://plaid.com/docs/libraries/ or https://github.com/plaid
1
star