• Credit

    US flag
  • Credit

    US flag

APIs & Features

Once you’ve completed the SDK setup, you can now create an instance of the card service and start working with real data.

Get Card View

The default view of the card is the collapsed view which displays only the PAN upfront. On clicking the card, users can toggle between the default view and the sensitive data view which requires their authentication. You can also integrate the copy feature along with the card view.

Sample UI

The following code snippet fetches the cardDetails:

Switch Theme
Expand More
Copy
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
[_cardManager getCardUIWithCardID:self.cardID
                              payload:@{}
                         defaultState:@"collapsed"
                           templateID:@"card_EN_UIVIEW"
                              success:^(UIView * _Nullable cardView) {
     // The cardview obtained can be added to some container and presented
    }
                              failure:^(ApolloCardErrorInfo * _Nonnull error) {
      NSLog(@"Get View Failed: %@", error.message);
    }];
Code Copied
Switch Theme
Expand More
Copy
1
2
3
4
5
6
7
cardManager.getCardUI(withCardID: cardId, payload: nil, defaultState: "collapsed", templateID: "card_EN_UIVIEW", success: { view in
      if view != nil {
        self.cardContainerView.addSubviewWithConstraints(view!)
      }
    }, failure: { error in
      print("CardUI failed with error: %@", error.message)
    })
Code Copied

Super PIN is a time-synced dynamic pin that changes every 2 minutes (configurable via backend logic). The app can query for the Super PIN with respect to different resources associated. User’s authentication is required to fetch the Super PIN.

Super PIN for resource

The return value is a Super PIN along with its validity in milliseconds. The following code snippet will allow you to fetch the super PIN for a selected resource.

Switch Theme
Expand More
Copy
1
2
3
4
5
6
7
 [self.cardManager generateSuperPINForResource:<RESOURCE_ID> completion:^(NSString * _Nullable superPin, NSTimeInterval validityInSeconds, ApolloCardErrorInfo * _Nullable error) {
        if(error) {
            NSLog(@"Failed to fetch super pin from Card: %@", error.message]);
        } else {
            NSLog(@"SuperPin fetched successfully from Card: %@", superPin);
        }
    }];
Code Copied
Switch Theme
Expand More
Copy
1
2
3
4
5
6
7
8
cardManager.generateSuperPIN(forResource: "<<RESOURCE_ID>>") { superPin, validityInSeconds, error in
      if error == nil {
        print("superPin generated %@",superPin!)
      }
      else {
        print("superPin generation failed with error %@",error!.message)
      }
    }
Code Copied

Super PIN API

The return value is a super PIN along with its validity in milliseconds. You can use this API when you’re sure that users have a single resource associated with their account holder ID. The following code snippet will allow you to fetch the super PIN

Switch Theme
Expand More
Copy
1
2
3
4
5
6
7
[self.cardManager generateSuperPINWithCompletion:^(NSString * _Nullable superPin, NSTimeInterval validityInSeconds, ApolloCardErrorInfo * _Nullable error) {
        if(error) {
            NSLog(@"Failed to fetch super pin from Card: %@", error.message]);
        } else {
            NSLog(@"SuperPin fetched successfully from Card: %@", superPin);
        }
    }];
Code Copied
Switch Theme
Expand More
Copy
1
2
3
4
5
6
7
8
cardManager.generateSuperPIN { superPin, validityInSeconds, error in
      if error == nil {
        print("superPin generated %@",superPin!)
      }
      else {
        print("superPin generation failed with error %@",error!.message)
      }
    }
Code Copied

Note: If you’re using the Cipher SDK along with the Cards SDK, you need to initialize Cipher SDK before accessing the Super PIN for Cards SDK.

Super PIN UI for Resource

Cards SDK also provides a UI for fetching the Super PIN for a selected resource. The UI adds a translucent black background on the existing screen and shows a popup containing the Super PIN. The UI theme and layout would act accordingly based on how the SDK has been configured.

The following code snippet will allow you to fetch the Super PIN UI for a resource.

Switch Theme
Expand More
Copy
1
2
3
4
5
[self.cardManager getSuperPinUIForResource:<RESOURCE_ID> success:^(UIView * _Nonnull superPinView) {
    // add view to superview here
  } failure:^(ApolloCardErrorInfo * _Nonnull error) {
    NSLog(@"Failed to fetch super pin from Card: %@", [error message]);
  }];
Code Copied
Switch Theme
Expand More
Copy
1
2
3
4
5
cardManager.getSuperPinUI(forResource: "<<RESOURCE_ID>>") { view in
        // add view to superview here
    } failure: { error in
      print("SuperPin UI failed with error: %@", error.message)
    }
Code Copied

Sample Response

Super PIN UI

The SDK provides a dedicated user interface for fetching the Super PIN. The UI adds a translucent black background on the existing screen and shows a popup containing the Super PIN.

The following code snippet will allow you to fetch the super PIN UI.

Switch Theme
Expand More
Copy
1
2
3
4
5
[self.cardManager getSuperPinUIWithSuccess:^(UIView * _Nonnull superPinView) {
    // add view to superview here
  } failure:^(ApolloCardErrorInfo * _Nonnull error) {
    NSLog(@"Failed to fetch super pin from Card: %@", [error message]);
  }];
Code Copied
Switch Theme
Expand More
Copy
1
2
3
4
5
cardManager.getSuperPinUI { view in
       // add view to superview here
    } failure: {  error in
      print("SuperPin UI failed with error: %@", error.message)
    }
Code Copied

Sample Response

Set Static PIN UI

The SDK also provides a user interface flow for setting the static PIN. Users are asked to enter the static PIN twice while setting up, and a set of validations such as PIN length are determined at this stage. After confirmation, this static PIN is stored in the encrypted vault.

The following code snippet will allow you to configure the UI for setting up the static PIN.

Switch Theme
Expand More
Copy
1
2
3
4
5
[self.cardManager launchCardPinUIForCardId:<card_id> success:^{
        NSLog(@"Card PIN Set Successfully");
    } failure:^(ApolloCardErrorInfo *userInfo) {
        NSLog(@"Setting Card Pin Failed with error: %@",userInfo.message);
    }];
Code Copied
Switch Theme
Expand More
Copy
1
2
3
4
5
cardManager.launchCardPinUI(forCardId: "<<CARD_ID>>") {
      print("Set PIN UI launched successfully")
    } failure: { error in
      print("Set PIN UI failed with error %@",error!)
    }
Code Copied

Change Static PIN UI

Along with setting up the static PIN during initial login, the SDK also provides a user interface to modify the already existing static PIN of the user. This static PIN authentication is closely coupled with the user authentication and it’s necessary for the users to enter their PIN during every app launch activity. The UI comprises three input fields where we can enter:

  • Old Static PIN
  • New Static PIN
  • Re-enter New Static PIN

The user interface does the following validations:

  • PIN lengths
  • Correctness of Old Static PIN entered
  • Equality of the New Static PIN entered twice

The following code snippet will allow you to modify the static PIN on the app.

Switch Theme
Expand More
Copy
1
2
3
4
5
[self.cardManager launchChangeCardPinUIForCardId:CARD_ID success:^{
    NSLog(@"Change pin successfully");
  } failure:^(ApolloCardErrorInfo *userInfo) {
    NSLog(@"Failed to change pin with error: %@", userInfo.message);
  }];
Code Copied
Switch Theme
Expand More
Copy
1
2
3
4
5
cardManager.launchChangeCardPinUI(forCardId: "<<CARDID>>") {
      print("Change PIN UI launched successfully")
    } failure: { error in
      print("Change PIN UI failed with error %@",error!)
    }
Code Copied

Sample Response

Block Card API

This API is used to block the card temporarily. The blocked cards via this API can be reactivated later.

Switch Theme
Expand More
Copy
1
2
3
4
5
self.cardManager blockCard:CARD_ID description:@"" success:^{
          NSLog(@"Card Blocked successfully");
      } failure:^(ApolloCardErrorInfo *userInfo) {
          NSLog(@"Card block Failed with error: %@",userInfo.message);
      }];
Code Copied
Switch Theme
Expand More
Copy
1
2
3
4
5
cardManager.blockCard("<<CARD_ID>>", description: "<<DESCRIPTION>>") {
      print("Card blocked successfully")
    } failure: { error in
      print("Block card failed with error %@",error!)
    }
Code Copied

Block Card UI

A customized user interface can be created for the blocking card functionality. This UI adds a translucent black background on the existing screen and shows a snackbar containing the option to either Cancel or Block the card.

The following code snippet will allow you to integrate this blocking UI:

Switch Theme
Expand More
Copy
1
2
3
4
5
[self.cardManager blockCardWithAlert:<CARD_ID> description:<Description> success:^{
    NSLog(@"Card blocked successfully");
  } failure:^(ApolloCardErrorInfo *userInfo) {
    NSLog(@"Card block failed");
  }];
Code Copied
Switch Theme
Expand More
Copy
1
2
3
4
5
cardManager.blockCard(withAlert: "<<CARD_ID>>", description: "<<DESCRIPTION>>") {
      print("Card block with alert launched successfully")
    } failure: { error in
      print("Block card failed with error %@",error!)
    }
Code Copied

Sample Response

Unblock Card API

After a user has blocked a card, this API will allow them to unblock the selected card straight from the app.

Switch Theme
Expand More
Copy
1
2
3
4
5
[self.cardManager unblockCard:CARD_ID description:@"" success:^{
          NSLog(@"Card unblocked successfully");
      } failure:^(ApolloCardErrorInfo *userInfo) {
          NSLog(@"Card unblock Failed with error: %@",userInfo.message);
      }];
Code Copied
Switch Theme
Expand More
Copy
1
2
3
4
5
cardManager.unblockCard("<<CARD_ID>>", description: "<<DESCRIPTION>>") {
      print("Card unblocked successfully")
    } failure: { error in
      print("Unblock card failed with error %@",error!)
    }
Code Copied

Unblock Card UI

The following code snippet will allow you to design a user interface for unblocking the card. The UI adds a translucent black background on the existing screen and shows a snackbar containing the option to either Cancel or Unblock the card.

The following code snippet will allow you to add the unblock card UI into your project:

Switch Theme
Expand More
Copy
1
2
3
4
5
[self.cardManager unblockCardWithAlert:<CARD_ID> description:<Description> success:^{
    NSLog(@"Card unblocked successfully");
  } failure:^(ApolloCardErrorInfo *userInfo) {
    NSLog(@"Card unblock failed");
  }];
Code Copied
Switch Theme
Expand More
Copy
1
2
3
4
5
 cardManager.unblockCard(withAlert: "<<CARD_ID>>", description: "<<DESCRIPTION>>") {
      print("Card unblock with alert launched successfully")
    } failure: { error in
      print("Unblock card failed with error %@",error!)
    }
Code Copied

Sample Response

Copy Card Number

The following code snippet adds the functionality of copying an un-masked card number to the clipboard. A toast message is displayed once the number has been copied and the user can paste it anywhere they want.

Switch Theme
Expand More
Copy
1
[self.cardManager copyCardNumberWithCardId:<CARD_ID];
Code Copied
Switch Theme
Expand More
Copy
1
cardManager.copyCardNumber(withCardId: "<<CARD_ID>>")
Code Copied

Front Face Card UI

The front-facing portion of the virtual card can be displayed as a user interface on your iOS app using the Cards SDK. This UI comes as a default with the Fusion SDK and you can do a lot of customizations depending upon your customer base.

The following code snippet lets you make customizations on the front-facing card UI:

Switch Theme
Expand More
Copy
1
2
UIViewController *frontFaceVC = [self.cardManager getCardList];
// present this Front face card viewController
Code Copied
Switch Theme
Expand More
Copy
1
2
var viewController =  cardManager.getCardList()
// present this Front face card viewController
Code Copied

Sample Response

Logout

When a user logs out of the app or wants to switch user sessions, you can utilize the following code in your project to safely log out that user. This is a necessary step to ensure that the SDK is working properly.

Switch Theme
Expand More
Copy
1
 [self.cardManager logout];
Code Copied
Switch Theme
Expand More
Copy
1
 cardManager.logout()
Code Copied

Exceptions and Error codes

All the exceptions thrown will have the following fields in addition to the message

  • code - The error code related to the response
  • traceId - The trace id which can be provided to Zeta support for identifying the root cause
  • type - The type of error (Added for verbosity)

Following are the error codes and their meaning:

[copy error codes from here]