Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Fusion APIs that deal with retrieval of Card information require the organization to be PCI DSS compliant. To avoid the burden of PCI compliance, Fusion introduces Card SDKs. By integrating these Card SDKs, the organizations can fetch sensitive Card details like PAN, Card CVV, and more.

In this article, SDK integration is documented in both Swift and Objective C languages.

Before you begin

Take care of the following prerequisites before you begin with SDK setup:

  • Fusion uses an authentication token to authenticate the SDK. To know how to generate an authentication token, see SDK Authentication.
  • Minimum iOS version required: 10
  • Minimum Cocoapods version required: 1.9.1
  • Install the code editor XCode.

Getting Started with iOS Card SDK

Follow the steps below to integrate SDK:

  1. Download the Framework which contains the structure and required libraries for your Project. 
  2. Now  install the SDK in your app.
  3. Prepare the   SDK setup.
  4. Now the SDK setup is ready to begin with verifying the SDK

Anchor
DownloadApolloFramework
DownloadApolloFramework
Step 1: Download the Framework

In Fusion, the SDKs are built on top of a Framework  which is a combined set of libraries to help you easily create a production-ready app, by providing a unified platform from where you can manage your app and observe the analytics of the app. The XC Framework packaging is used to package different variants of the Framework to support any platform such as iOS, macOS and others. 

Extract the below zip folder containing XCFramework

Div
classcustom-zip-cls

View file
nameCard_XCFramework.zip
height150

Anchor
InstalltheSDK
InstalltheSDK
Step 2: Install the SDK

The iOS Card SDK is compatible with apps supporting iOS 10 and above. To install the SDK, follow these steps:

  1. Drag & drop XCFramework manually into your project's target. 

  2. Click Embed & sign under the XCFramework in your project's target. 

  3. Set Allow Non-modular Includes in Framework Modules to "YES" under Target > Build Settings.
  4. Set Enable Bitcode to "NO" under TargetBuild Settings.

Anchor
Configureyourapp
Configureyourapp
Step 3: Set up the SDK

Follow the steps below to set up the SDK: 

1. Adding the Configuration file

A configuration file contains all the configurations necessary for activating the SDK. You should add the file to your project to prepare your app to work with the SDK. You will receive the configuration file through email. If you haven't received the file, contact Zeta.  

2. Declaring the SDK

To access the iOS Card APIs, you need to create an instance of ApolloCardManager. We recommend keeping the ApolloCardManager instance global in your AppDelegate file.

Div
classcustomtabs remove-codeblock-space
Div
classtabsmenu
Div
classtabsmenu_1

Swift

Div
classtabsmenu_2

Objective C

Div
classtabscontent
Div
classtabpage_1
Code Block
themeMidnight
titleDeclaration
var cardManager: ApolloCardManager?
Div
classtabpage_2
Code Block
themeMidnight
titleDeclaration
@property (nonatomic, strong) ApolloCardManager *cardManager; 

3. Initializing the SDK

You should initialize the ApolloCardManager object to access the Card SDK APIs. This object is assigned to the variable CardManager as shown in the below code snippet. We recommend to initialize the SDK on the app launch itself.

Div
classcustomtabs remove-codeblock-space
Div
classtabsmenu
Div
classtabsmenu_1

Swift

Div
classtabsmenu_2

Objective C

Div
classtabscontent
Div
classtabpage_1
Code Block
themeMidnight
titleAdding instances
linenumberstrue
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

    self.cardManager = ApolloCardManager()
     return true
}
Div
classtabpage_2
Code Block
themeMidnight
titleAdding instances
linenumberstrue
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

 self.cardManager = [[ApolloCardManager alloc] init]; 
 return YES;
} 

4. Registering the SDK

Card SDK registration triggers the authentication of the SDK using an authentication token. This token is also called a JSON Web Token (JWT) token. Registering the Card SDK involves only two steps:

  1. Create the authentication token (JWT Token). To know how to generate an authentication token, see SDK Authentication.
  2. Invoke a call to registerSDK method by passing the authentication token.

On successful authentication of SDK, you can access the getCardWithCardID and setPinWithCardID APIs. 

Please ensure to set a valid JWT token every time to register the SDK. We recommend calling the method inside the following Application function.

Div
classcustomtabs remove-codeblock-space
Div
classtabsmenu
Div
classtabsmenu_1

Swift

Div
classtabsmenu_2

Objective C

Div
classtabscontent
Div
classtabpage_1
Code Block
themeMidnight
titleApplication function
linenumberstrue
func applicationDidBecomeActive(_ application: UIApplication) {
    self.cardManager?.registerSDK(authToken:<JWT_TOKEN>)
}
Div
classtabpage_2
Code Block
themeMidnight
titleApplication function
linenumberstrue
- (void)applicationDidBecomeActive:(UIApplication *)application {
    [self.cardManager registerSDKWithAuthToken:<JWT_TOKEN>];
 
}
Note

If you are using Scenes for iOS 13, do the registration in the sceneDidBecomeActive method in your applicable SceneDelegate.


Anchor
CardSDKMethods
CardSDKMethods
Step 4: Verify the SDK

After successful SDK setup, you can validate the SDK integration using the following APIs:

Fetch Card Details

Fetch Card Details API enables you to retrieve Card information. In this API call, you should pass the Card identifier (CardID). 

Parameters descriptions:

  • CardID: A unique identifier of the Card whose details are to be fetched.


Div
classcustomtabs remove-codeblock-space
Div
classtabsmenu
Div
classtabsmenu_1

Swift

Div
classtabsmenu_2

Objective C

Div
classtabsmenu_3

Sample Output

Div
classtabscontent
Div
classtabpage_1
Code Block
themeMidnight
titleGet card with cardID
linenumberstrue
let cardID = "<<some card id>>"
self.cardManager?.getCardWithCardID(cardID, authToken:authToken, success: { (card : ApolloCard?) in
            print("Card = %@", card);
        }) { (error : Error?) in
            print("Error = %@", error);
        }
Div
classtabpage_2
Code Block
themeMidnight
titleGet card with cardID
linenumberstrue
[self.cardManager getCardWithCardID:@"<<CARD_ID>>"     
                    success:^(ApolloCard *card) {
                       //  << SUCCESS_BLOCK >>
                    }
                    failure:^(NSError *error) {
                      // <<FAILURE_BLOCK>>
}];
Div
classtabpage_3

This is a sample model output which retrieves all the Card information.

Code Block
themeMidnight
titleApollo Card Model
linenumberstrue
collapsetrue
@interface ApolloCard : NSObject

@property (nonatomic, readonly) NSString *CardID;
@property (nonatomic, readonly) NSString *crn;
@property (nonatomic, readonly) NSString *CardType;
@property (nonatomic, readonly) NSString *maskedPan;
@property (nonatomic, readonly) NSString *CardStatus;
@property (nonatomic, readonly) NSString *associatedAt;
@property (nonatomic, readonly) ApolloDecryptedCardDetails 
@property (nonatomic, readonly) NSString *tenantAttributes;
@property (nonatomic, readonly) BinRange *binRange;
@property (nonatomic, readonly) NSArray *vectors;
@property (nonatomic, readonly) NSString *CardSku;
@property (nonatomic, readonly) NSString *headers;
@property (nonatomic, readonly) SensitiveView *sensitiveView;
@property (nonatomic, readonly) NSDictionary *rawCardDetails;
@end

@interface ApolloDecryptedCardDetails: NSObject //Deprecated. The decrypted Card details will be removed in future versions. For now you can use NSDictionary instead of ApolloDecryptedCardDetails.

@property (nonatomic, readonly) NSString *CardID;
@property (nonatomic, readonly) NSString *createdAt;
@property (nonatomic, readonly) NSString *cvv;
@property (nonatomic, readonly) NSString *expiry;
@property (nonatomic, readonly) BOOL isVirtual;
@property (nonatomic, readonly) NSString *pan;
@end

@interface BinRange: NSObject

@property (nonatomic, readonly) NSString *bin;
@property (nonatomic, readonly) NSString *range;
@end

@interface SensitiveView: NSObject

@property (nonatomic, readonly) NSString *algo;
@property (nonatomic, readonly) SensitiveViewValue *value;
@end

@interface SensitiveViewValue: NSObject

@property (nonatomic, readonly) NSString *serverPublicKey;
@property (nonatomic, readonly) NSString *encryptedData;
@property (nonatomic, readonly) NSString *iv;
@end


Set Card PIN

Set Card PIN API enables you to perform set PIN operation on the Card. In this API call, you should pass the Card identifier (CardID ) and a new Card PIN requested (pin)

Parameters descriptions:

  • CardID: A unique identifier of the Card whose PIN are to be set.
  • pin: A four digit security PIN to be associated with the Card.
Div
classcustomtabs remove-codeblock-space remove-extra-para
Div
classtabsmenu
Div
classtabsmenu_1

Swift

Div
classtabsmenu_2

Objective C

Div
classtabscontent
Div
classtabpage_1
Code Block
themeMidnight
titleSet Card PIN
linenumberstrue
 CardManager?.setPinWithCardID("<<Card_id>>",
              pin: "<<new_pin>>",
              success: {
                          NSLog("Changed pin successfully")
   					   },
              failure: { (errorInfo) in
                          NSLog("Failed to change pin");
})
Div
classtabpage_2
Code Block
themeMidnight
titleSet Card PIN
linenumberstrue
[self.cardManager setPinWithCardID:@"<<CARD_ID>>" pin:@"<<NEW_PIN>>" success:^{
          //  << SUCCESS_BLOCK >>
      } failure:^(ApolloCardErrorInfo *userInfo) {
          // <<FAILURE_BLOCK>>
      }];


Logout

When a user logs out from the app, ensure that you clear all the session data. A default call to Logout method is important for the SDK to work properly in next login session.

A simple logout is available by using: 

Div
classcustomtabs remove-codeblock-space
Div
classtabsmenu
Div
classtabsmenu_1

Swift

Div
classtabsmenu_2

Objective C

Div
classtabscontent
Div
classtabpage_1
Code Block
themeMidnight
titleLogout
self.cardManager?.logout()
Div
classtabpage_2
Code Block
themeMidnight
titleLogout
[self.CardManager logout]
Panel
Div
classalignLeftIcon

On this page:

Table of Contents

Div
classhelp-box

Need Help?

Drop a mail at fusion-support@zeta.tech or call us on 080-6690 5995.