Coder Social home page Coder Social logo

plaid-java's Introduction

plaid-java Circle CI Maven Central

Java Bindings for the Plaid API (https://www.plaid.com/docs).

The whole available Plaid API is defined in the PlaidApiService 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>4.0.2</version>
</dependency>

Versioning

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

API version plaid-java release
2018-05-22 (latest) 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.

Basic Usage

// Use builder to create a client
PlaidClient plaidClient = PlaidClient.newBuilder()
  .clientIdAndSecret("your_client_id", "your_secret")
  .publicKey("your_public_key") // optional. only needed to call endpoints that require a public key
  .sandboxBaseUrl() // or equivalent, depending on which environment you're calling into
  .build();


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

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


// Asynchronously do the same thing. Useful for potentially long-lived calls.
plaidClient.service()
    .itemPublicTokenExchange(new ItemPublicTokenExchangeRequest(publicToken))
    .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 {
  ErrorResponse errorResponse = plaidClient.parseError(response);
} catch (Exception e) {
  // deal with it. you didn't even receive a well-formed JSON error response.
}

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.

plaid-java's People

Contributors

erimag avatar davidzhanghp avatar michaelckelly avatar blockmar avatar notthefakestephen avatar adamlangsner avatar dudehook avatar webbsurfer avatar pbernasconi avatar peteraarum avatar dsfish avatar arjunpuri-plaid avatar arjunpur avatar colinmorelli avatar ewiner avatar gkatalevsky avatar jeeyoungk avatar larsjoakimgrahn avatar vanvlack avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.