Skip to content

ricburton/plaid-swift

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

plaid-swift

Swift wrapper for the Plaid API. See Plaid docs for more info.

##Quick start #####1) Copy the Plaid.swift file into you project:

#####2) In your AppDelegate.swift file, initialize plaid-swift with your client_id and secret:

Initialize plaid-swift

See BaseURL section below for more info

Plaid.initializePlaid(clientId: "Your client_id", secret: "Your secret", appStatus: .Testing or .Production)

#####3) Use plaid-swift functions (They all begin with "PS_")

Use plaid-swift functions

See Functions

####MFA functionality working, check back for updated documentation

##Usage

userType and institution take an Enum as an input.

Institutions and Accounts returned by plaid-swift functions are Structs with various properties associated with each. See below for more info.

##Functions ####PS_addUser

PS_addUser(userType: Type, username: String, password: String, pin: String?, instiution: Institution) { (response, accessToken, mfaType, mfa, accounts, transactions, error) -> () in
	//NOTE: pin param only required for USAA 

	//Returns user access_token 

	//Returns MFA requirements if valid
}

####PS_getUserBalance

PS_getUserBalance(accessToken: String) { (response, accounts, error) -> () in
	//Returns array of Accounts 
}

####PS_getUserTransactions

PS_getUserTransactions(accessToken: String, showPending: Bool, beginDate: String?, endDate: String?) { (response, transactions, error) -> in 
	//Returns array of Transactions
}

##Enums ####BaseURL

enum BaseURL {
    case Production //Endpoint: https://tartan.plaid.com
    case Testing    //Endpoint: https://api.plaid.com
}

####Institution

public enum Institution {
    case amex
    case bofa
    case capone360
    case schwab
    case chase
    case citi
    case fidelity
    case us
    case usaa
    case wells
}

####Type

public enum Type {
    case Auth
    case Connect
}

##Structs ####Institution

public struct Transaction {
	//Standard properties
    let account: String
    let id: String
    let amount: Double
    let date: String
    let name: String
    let pending: Bool
    
    //Optional properties
    let address: String?
    let city: String?
    let state: String?
    let zip: String?
    let storeNumber: String?
    let latitude: Double?
    let longitude: Double?
    let trxnType: String?
    let locationScoreAddress: Double?
    let locationScoreCity: Double?
    let locationScoreState: Double?
    let locationScoreZip: Double?
    let nameScore: Double?
    let category:NSArray?
    ...
}

####Account

public struct Account {
	//Standard properties
    let institutionName: String
    let id: String
    let user: String
    let balance: Double
    let productName: String
    let lastFourDigits: String
    //Optional properties
    let limit: NSNumber?
    ...
}

##Known Issues ####Date bounding: Currently not working

####Supported institutions:

  1. American Express
  2. Bank of America
  3. Chase
  4. Citi
  5. Wells Fargo
  6. USAA (requires user PIN)
  7. US Bank

####Untested institutions

  1. Charles Schwab
  2. Fidelity
  3. Silicon Valley Bank

####Unsupported institutions (As of 28 April): These are institutions with Plaid endpoints but no actual data yet. Check Plaid for additional info.

  1. PNC
  2. Capital One 360

About

Swift wrapper for the Plaid API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 100.0%