Link iOS SDK

Reference for integrating with the Link iOS SDK

Overview

The Plaid Link SDK is a quick and secure way to link bank accounts to Plaid from within your iOS app Link is a drop-in framework that handles connecting a financial institution to your app (credential validation, multi-factor authentication, error handling, etc).

To get started with Plaid Link for iOS, clone the GitHub repository and try out the example application, which provides a reference implementation in Swift. Youʼll want to sign up for free API keys through the Plaid Developer Dashboard to get started.

Examples of Plaid Link for iOS

Installation

Plaid Link for iOS is an embeddable framework that is bundled and distributed within your application. There are several ways to obtain the necessary files and keep them up-to-date; we recommend using CocoaPods. Regardless of what you choose, submitting a new version of your application with the updated LinkKit.xcframework to the App Store is required.

Requirements

A new version of LinkKit.xcframework will be released around the 15th of every month. We recommend you keep up to date to provide the best Plaid Link experience in your application.

Upgrading

Please see our GitHub releases for version release notes. Steps to upgrade to the latest version can be found at the iOS 1.x to 2.x migration guide.

CocoaPods
  1. If you haven’t already, install the latest version of CocoaPods.
  2. If you don’t have an existing Podfile, run the following command to create one:
    1
    pod init
  3. Add this line to your Podfile:
    1
    pod 'Plaid'
  4. Run the following command:
    1
    pod install
  5. To update to newer releases in the future, run:
    1
    pod install
Manual

Get the latest version of LinkKit.xcframework and embed it into your application.

Embed LinkKit.xcframework into your application, for example by dragging and dropping the file onto the Embed Frameworks build phase as shown below.

Embed LinkKit.xcframework

Depending on the location of the LinkKit.xcframework on the filesystem you may need to change the Framework Search Paths build setting to avoid the error: fatal error: 'LinkKit/LinkKit.h' file not found. For example, the LinkDemo Xcode projects have it set to FRAMEWORK_SEARCH_PATHS = $(PROJECT_DIR)/../ since the LinkKit.xcframework file is shared between them and is kept in the directory that also contains the demo project directories.

Edit framework search paths build setting
Register your redirect URI

To register your redirect app URI:

  1. Log into your Plaid Dashboard at the API page
  2. Next to Allowed redirect URIs click Configure then Add New URI
  3. Enter your redirect URI, for example www.plaid.com/redirect
  4. Click Save Changes. You may be prompted to re-enter your password.

These redirect URIs must be set up as universal links. For more information on universal links see Allowing Apps and Websites to Link to Your Content.

Your iOS app is now set up and ready to start integrating with the Plaid SDK.

Opening Link

Before you can open Link, you need to first create a link_token. A link_token can be configured for different Link flows and is used to control much of Link’s behavior. To learn how to create a new link_token, see the API Reference entry for /link/token/create.

Create a LinkTokenConfiguration

Each time you open Link, you will need to get a new link_token from your server and create a new LinkTokenConfiguration object with it.

1
2
3
4
5
6
let configuration = LinkTokenConfiguration(
token: token,
onSuccess: { linkSuccess in
// Send the linkSuccess.publicToken to your app server.
}
)
Create a Handler

Create a Handler - A Handler is a one-time use object used to open a Link session. The Handler must be retained for the duration of the Plaid SDK flow. It will also be needed to respond to OAuth universal link redirects as described in the OAuth guide.

1
2
3
4
5
6
7
let result = Plaid.create(configuration)
switch result {
case .failure(let error):
logger.error("Unable to create Plaid handler due to: \(error)")
case .success(let handler):
self.handler = handler
}
Open Link

Finally, open Link by calling open on the Handler object.
This will usually be done in a button’s target action.

onSuccess

onExit

onEvent

OAuth

Using Plaid Link with an OAuth flow requires some additional setup instructions. For details, see the OAuth Guide.