• Credit

    US flag
  • Credit

    US flag

About iOS Card SDK

We developed a custom card SDK for iOS to support your fintech applications on all Apple smartphones. This card SDK takes care of all the compliance related to card issuance, its lifecycle, and various operations for your fintech product. This section explains how to set up your card SDK for an iOS application and some of the SDK’s features.

Prerequisites

Before beginning with the SDK setup, we’d highly recommend that you take a note of the following checklists:

  • Fusion uses an authentication token to validate the SDK
  • Minimum iOS version required: 10
  • Minimum Cocoapods version required: 1.9.1
  • Ensure you have a supercardSdk.plist file which contains configuration data necessary to set up the SDK. Contact Zeta in case you haven’t received the file.

iOS SDK Setup

Step 1: Adding the SDK

The iOS Card SDK is compatible with apps supporting iOS version 10 and above. To add the ApolloCardFramework to your project, follow these steps:

  1. Set up Cocoapods using the simple steps mentioned in this link.
  2. Open the Podfile created in your project and add ApolloCardsFramework dependency as mentioned in the code below:

Switch Theme
Expand More
Copy
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
source 'https://bitbucket.org/zetaengg/iapollopubliccocoapodspecs'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target 'AppTarget' do
 pod 'ApolloCardsFramework'
 pod 'Block-KVO', :git => 'git@github.com:Tricertops/Block-KVO.git'
end
post_install do |installer|
   installer.pods_project.targets.each do |target|
       target.build_configurations.each do |config|
           config.build_settings['ENABLE_STRICT_OBJC_MSGSEND'] = 'NO'
           if target.name == "ReactiveCocoa"
           config.build_settings['ENABLE_NS_ASSERTIONS'] = 'NO'
         end
       end
   end
end
Code Copied
3. Set Enable Bitcode to NO under Target > Build Settings.

Step 2 : Setting up the SDK

  • Adding configuration files

A configuration file contains all the properties necessary for activating the SDK. You should add the file to the main target of your project to prepare the app to work with the SDK. You will receive the configuration file named supercardSdk.plist through email. If you haven’t received the file, contact Zeta.

  • Adding theme & template files

Card SDK provides you with the capability to define the theme and layout used by the SDK. These can be edited remotely so you won’t have to ship a new app build for changing how your view looks. You can change your theme by contacting Zeta and it will reflect on your app on the next launch.

  • Configure properties

To enable authentication using face recognition (Face ID), add a value to the NSfaceIdUsageDescription (Privacy - Face ID Usage Description) with a message in the info.plist file.

Step 3: Initialize the SDK

Create the ApolloCardManager instance in your AppDelegate file. Initialize it inside the applicationdidFinishLaunchingWithOptions: method of your Applicationclass. Keep the instance for ApolloCardManager globally accessible.

Objective C

Switch Theme
Expand More
Copy
1
2
3
4
5
6
7
8
9
#import "AppDelegate.h"  
#import <ApolloCards/ApolloCardManager.h>
@implementation AppDelegate
 
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.cardManager = [[ApolloCardManager alloc] init];
 
    return YES;
}
Code Copied

Step 4. Integrating the SDK

The step involves SDK authentication and setting up the SDK. Card SDK is stateful by default. Before beginning with the integration, you should create a logic to authenticate the users.

Authenticating Cards SDK

For a user to be able to use the cards SDK through your app, you need to authenticate the user with the tenantAuthToken. The tenantAuthToken needs to be computed in your backend as it needs sensitive information to create the token. The information used to generate the tenantAuthToken should never be compromised.

Set the tenantAuthToken to the Cards SDK once the user logs into your app so that you’ll have sufficient information to generate the token.

The following code snippet allows you to authenticate the SDK:

Switch Theme
Expand More
Copy
1
  [self.cardManager authenticateSDKWithTenantAuthToken:@"JWT_TOKEN"                          andAccountHolderID:@"ACCOUNT_HOLDER_ID"];
Code Copied

Note:

  1. This step has to be performed during the first login of the user or when an already existing tenantAuthToken expires.
  2. A tenantAuthToken has an associated validity with it. The ideal practice is to reset a new token before it expires.

Setting up the SDK

This step should be performed after the SDK authentication. Post the authentication of the SDK, you can integrate this logic whenever your app is launched on the customer’s mobile. To know whether the authentication step has been completed, you can configure a listener to the SDKStatusAuthenticated event as shown below:

Switch Theme
Expand More
Copy
1
2
3
4
5
6
7
8
- (void) setUpSDK {
    [self.cardManager setUpSDKWithResourceID:nil, success:^{
        NSLog(@"SDK initialised successfully");
 
    } failure:^(ApolloCardErrorInfo *userInfo) {
        NSLog(@"SDK initialisation failed with error %@", userInfo.message);
    }];
}
Code Copied

Now for storing the card details and the authentication details securely, we use encrypted storage and hide the data behind the user’s authentication. If you are an issuer, you can provide a custom implementation of your own encrypted storage.

The following code snippet explains how to achieve this step:

Switch Theme
Expand More
Copy
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#import "EncryptedStore.h"
@interface EncryptedStore()<AppSecuredStoreAccess>
@end
@implementation EncryptedStore
- (void)dataForKey:(NSString *)key completion:(void (^)(NSError *, NSData *))completion {
    // code to get data and pass data in completion block
    completion(nil, [NSData data]);
}
- (void)setData:(NSData *)data forKey:(NSString *)key completion:(void (^)(NSError *))completion {
    // code to save data
    if(completion) {
        completion(nil);
    }
}
- (void)resetAllData {
    // code to delete all data
}
@end
Code Copied