Statement SDK Usage

A step-by-step guide on how to initialize Statement SDK on iOS.

πŸ‘

Visit our Brankas Collection for iOS, to see a sample project of how to integrate the SDK.

πŸ“˜

Minimum Requirements

  1. Xcode 14 but preferably the latest version
  2. Minimum Target iOS Deployment: iOS 12
  3. Minimum Swift Tools Version: 5.3 but preferably the latest version

Installation & Updating

Please refer to the Installation page for iOS platform installation and update steps

Initialization

  1. Call the initialize function from the TapFramework and pass the API Key provided by Brankas.
import StatementTapFramework

StatementTapSF.shared.initialize(apiKey: "apiKey")

πŸ“˜

Before calling any function, it is important to call the initialize function first in order to gain access to the checkout function. Also, to use the Sandbox environment, set the isDebug variable to true

Usage

The Framework has a checkout function wherein it responds with a redirect url used to launch the Tap web application within built-in WKWebView or Safari Web Browser.

In order to use the checkout function, a StatementTapRequest is needed to be created and be passed. It has the following details:

  1. country - refers to the country of origin of the bank you wanted to do statement retrieval with. There are three countries currently supported: Philippines (PH), Indonesia (ID) and Thailand (TH)

  2. bankCodes - refers to the list of banks to be shown within the Tap Web Application. If null value is passed, the Freamework automatically fills up all the available banks depending on the country passed.

  3. externalId - refers to the identifier passed to track the request.

  4. successURL - refers to the URL where the user will be redirected to after a successful statement retrieval.

  5. failURL - refers to the URL where the user will be redirected to after a failed statement retrieval.

  6. organizationName - refers to the name of the organization that will be displayed while doing statement retrieval.

  7. redirectDuration - refers to the time in seconds when the user should be redirected upon finishing statement retrieval. The default value is 60 seconds.

  8. browserMode - Safari (Tap Web Application is launched through Safari Web Browser) and WebView (Tap Web application is launched through the built-in WKWebView from the Framework).

πŸ“˜

When using the WebView BrowserMode, ensure that the ViewController to be passed in the checkout function is attached to a UINavigationController so that the Framework can provide a back button.

  1. dismissAlert - pertains to the showing of alert dialog when closing the WebView. It consists of message, positiveButtonText and negativeButtonText. Just set this value to null to remove the alert dialog when closing the application.

  2. isAutoConsent - refers to the automatic allowing of consent in behalf of the user of the Tap Web Application. Its default value is false.

  3. useRememberMe - pertains to using the remember me feature of the Tap Web Application (default value is true and will not be showing up if set to false).

  4. statementRetrievalRequest - pertains to the statement retrieval after Tap Web Session. startDate and endDate can be configured to retrieve transactions within date range

  5. includeBalance - refers to the inclusion of balance within statement retrieval; default value is false

Here is a sample on how to use it and call:

import UIKit
import StatementTapFramework

class ViewController: UIViewController {
    typealias T = String
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        
        StatementTapSF.shared.initialize(apiKey: "API KEY")

        let request = StatementTapRequest(country: Country.PH, bankCodes: nil, externalId: "External ID", successURL: "https://google.com", failURL: "https://hello.com", organizationName: "Organization Name", redirectDuration: 60, browserMode: StatementTapRequest.BrowserMode.WebView, isAutoConsent: false, dismissAlert: nil, useRememberMe: true, statementRetrievalRequest: StatementRetrievalRequest())

        do {
            let retrieveStatements = { (data: Any?, error: String?) in
                if let str = data as? String {
            		if let err = error {
                		print("Statement ID: \(str)\nError: \(err)")
            		}
            		else {
                		print("Statement ID: \(str)")
            		}
        	}
        
        	else if let statements = data as? [Statement] {
            		var message = "Statements"
            		let dateFormatter = DateFormatter()
           	 	dateFormatter.dateFormat = "MM-dd-yyyy"
            
            		if statements.isEmpty {
                		message += "\n\n\nList is Empty"
            		}
            		statements.forEach { statement in
                		statement.transactions.forEach { transaction in
                    			let amount = transaction.amount
                    			message += "\n Account: \(statement.account.holderName)"
                    			message += "\n Transaction: (\(dateFormatter.string(from: transaction.date))) "
                    			message += String(describing: amount.currency)
                    			message += " \(Double(amount.numInCents) ?? 0 / 100)"
                    			message += " \(String(describing: transaction.type))"
                		}
            		}
            		print(message)
        	}
        
        	else {
            		if let err = error {
                		showAlert(message: "Error: \(err)")
            		}
        	}
            }
            try StatementTapSF.shared.checkout(statementTapRequest: request, vc: self, closure: retrieveStatements, showBackButton: true)
        } catch {
            showAlert(message: "Error: \(error)")
        }
    }
}

App Tracking Transparency

Apple introduced this new feature, starting iOS 14.5. Users can decide whether the current app being used will be given a permission to track activity and usage for the purposes of advertising and data sharing. With this, iOS mobile applications have to abide certain guidelines created by Apple (https://developer.apple.com/app-store/app-privacy-details/) to ensure security and privacy of its users. Each iOS application should inform its users if sensitive information should be used through the App Tracking Transparency Framework.

Logging of Tap Web Flow

This new feature has been added internally, starting v4.0 of Statement Tap Framework. Brankas can track the flow of a transaction while performing a Statement Retrieval within Tap Web App. This will aid in pointing out some errors within transactions and eventually improve the overall experience.

How necessary to integrate App Tracking Transparency Framework

It is not needed to integrate this Framework when using Statement Tap Framework. It is ensured that no private information of users is being sent. The logging system can only track the transaction flow but will not be able to determine from which user it belongs to specifically. The data will only be used for checking inconsistencies within a transaction flow. We ensure that it will not be shared nor will be used for advertisement.

How to turn off the logging feature

The logging feature is enabled by default. To turn off the feature, you can change the value of isLoggingEnabled within the initialize() function as the below sample;


import StatementTapFramework

StatementTapSF.shared.initialize(apiKey: "apiKey", isDebug: false, isLoggingEnabled: false)

How to integrate App Tracking Transparency Framework

The developer has to create the code manually within the mobile application. Below is a sample integration:


import StatementTapFramework

    private func showTrackingPermission() {
        if #available(iOS 14, *) {
            ATTrackingManager.requestTrackingAuthorization { status in
                switch status {
                    case .authorized:
			StatementTapSF.shared.initialize(apiKey: "apiKey", isDebug: false, isLoggingEnabled: true)
                    case .denied:
                        fallthrough
                    case .notDetermined:
                        fallthrough
                    case .restricted:
			StatementTapSF.shared.initialize(apiKey: "apiKey", isDebug: false, isLoggingEnabled: false)
                    default:
			StatementTapSF.shared.initialize(apiKey: "apiKey", isDebug: false, isLoggingEnabled: false)
                }
            }
        }
    }