Plaid logo
Docs
ALL DOCS

Link

  • Overview
Libraries
  • Web
  • iOS
  • Android
  • React Native
  • Webview
Core Link flows
  • OAuth guide
  • Update mode
  • Preventing duplicate Items
  • Data Transparency Messaging migration
  • Account Select v2 migration guide
  • Link Token migration guide
  • Legacy public key integrations
Optimizing Link
  • Optimizing Link conversion
  • Measuring Link conversion
  • Pre-Link messaging
  • Customizing Link
  • Choosing when to inititalize products
  • Returning user experience
  • Modular Link (UK/EU only)
Errors and troubleshooting
  • Troubleshooting
  • Handling an invalid Link Token
  • Institution status in Link
Plaid logo
Docs
Plaid.com
Get API keys
Open nav

2.x to 3.x Migration Guide

Reference for migrating the Link Android SDK from 2.x to 3.x

Summary of changes

Plaid released the Android 3.0.0 SDK on September 20th, 2020. Upgrading to the new 3.x SDK allows you to take advantage of a unified mobile API and support all new features. This article provides a guide on how to upgrade a Plaid integration from the Android 2.x SDK to the 3.x SDK.

Remove initialize

Select Language
Copy
1Plaid.initialize(this)

Is no longer part of the API and can be removed.

Opening Link

Creating Configuration
2.x.x3.x.x
com.plaid.link.configuration.LinkConfigurationcom.plaid.link.configuration.LinkPublicKeyConfiguration
LinkPublicKeyConfiguration.paymentTokenUse the LinkPublicKeyConfiguration.token field instead
com.plaid.link.configuration.AccountSubtypecom.plaid.link.result.LinkAccountSubtype
com.plaid.link.configuration.AccountTypecom.plaid.link.result.LinkAccountType
PlaidEnvironmentdeprecated
PlaidProductdeprecated
Select Language
Copy
1val linkTokenConfiguration = linkTokenConfiguration {
2 token = "LINK_TOKEN_FROM_SERVER"
3 logLevel = if (BuildConfig.DEBUG) LinkLogLevel.VERBOSE else LinkLogLevel.ERROR
4}
PlaidHandler

Create a PlaidHandler - A PlaidHandler is a one-time use object used to open a Link session. It should be created as early as possible, since it must be completed before Link opens, and if delayed until just before Link opening it can have a perceptible impact on Link startup time.

Select Language
Copy
1val plaidHandler: PlaidHandler = Plaid.create(application, linkTokenConfiguration)
Opening Link

We've removed the openLink functions on the Plaid object as well as the Kotlin extension functions for Activity and Fragment.

Select Language
Copy
1Plaid.openLink(activity, configuration)
Copy
1this@MyActivity.openPlaidLink(configuration)
Copy
1this@MyFragment.openPlaidLink(configuration)

Instead you will need to call open on the PlaidHandler you created, passing in an Activity or Fragment.

Select Language
Copy
1plaidHandler.open(activity)

Handling Results

LinkResultHandler

com.plaid.link.result.PlaidLinkResultHandler has been renamed to com.plaid.link.result.LinkResultHandler

LinkSuccessMetadata

LinkSuccessMetadata.rawMetadata renamed to LinkSuccessMetadata.metadata

LinkAccount

Fields renamed

  • accountId -> id
  • accountName -> name
  • accountNumber -> mask
  • accountSubtype -> subtype also type changed from String to com.plaid.link.result.LinkAccountSubtype
  • accountType has been removed, it is now a com.plaid.link.result.LinkAccountType object within LinkAccountSubtype
Select Language
Copy
1private val linkResultHandler = LinkResultHandler(
2 // ...
3 onSuccess = { it: LinkSuccess ->
4 // Send public_token to your server, exchange for access_token
5 val publicToken = it.publicToken
6 val metadata = it.metadata
7 metadata.accounts.forEach { account ->
8 val accountId = account.id
9 val accountName = account.name
10 val accountMask = account.mask
11 val accountSubType = account.subtype
12 }
13 val institutionId = metadata.institution?.id
14 val institutionName = metadata.institution?.name
15 }
16)
LinkError
  • errorCode has been typed as an ErrorCode object
  • errorType has been removed from LinkError and added to the ErrorCode object
  • errorJson field has been added with raw JSON from server
LinkExitMetadata
  • institutionId and institutionName moved into institution which is a LinkInstitution and renamed to id and name object
  • exitStatus removed
  • metadataJson field has been added with raw JSON from server
Select Language
Copy
1private val linkResultHandler = LinkResultHandler(
2 // ...
3 onExit = {
4 val error = it.error
5 error?.let { error ->
6 val errorCode = error.errorCode
7 val errorType = error.errorCode.errorType
8 val errorMessage = error.errorMessage
9 val displayMessage = error.displayMessage
10 }
11 val metadata = it.metadata
12 val institutionId = metadata.institution?.id
13 val institutionName = metadata.institution?.name
14 val linkSessionId = metadata.linkSessionId;
15 val requestId = metadata.requestId;
16 }
17)

Handling Events

LinkEventMetadata metadataJson added with raw JSON from server

Exceptions

All exceptions moved from com.plaid.link.internal.exceptions to com.plaid.link.exceptions

Was this helpful?
Developer community
GitHub
GitHub
Stack Overflow
Stack Overflow
YouTube
YouTube
Twitter
Twitter
Discord
Discord