• Credit

    US flag
  • Credit

    US flag

APIs & Features

After you have successfully completed the steps from the previous section you are now ready to use an instance of CardsService to work with your customers card details.

You are now ready to use the CardManager to work with your user’s card details.

Get Card View

You can get the card view with the layout and styles configured specifically for your app with the Zeta platform. The default state of the view returned is the collapsed view which shows only the card PAN.

On clicking the view, the user can toggle between the collapsed and the sensitive info states. User authentication is required for accessing the sensitive state of the cards view if the user has not been asked for authentication already in the current app session.

You also have a copy card number feature on the view to copy the card on the clipboard. Here is the code snippet to fetch 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

Super PIN for Resource

The return value is a Super PIN along with the validity in milliseconds.

Here is a code snippet on how you can fetch the Super PIN for a given 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

Note: Use this only when you are sure that users have a single resource associated with their accountHolderId’s

The return value is a Super PIN along with the validity in milliseconds.

Here is a code snippet on how you can 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: When 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 given resource. The UI adds a translucent black background on the existing screen and shows a popup containing the Super PIN. The UI is in accordance with the theme with which the SDK has been configured.

Here is a code snippet on how you can 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

Note: Use this only when you are sure that users have a single resource associated with their accountHolderId’s

Cards SDK also provides a UI 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 UI is in accordance with the theme with which the SDK has been configured.

Here is a code snippet on how you can fetch the Super PIN UI assuming a single resource.

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

Cards SDK exposes this API to expose the set static PIN functionality along with the UI. The UI is in accordance with the theme with which the SDK has been configured. This API is behind user authentication and requires authentication per launch of the app.

Here is the code snippet for the same.

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

Cards SDK provides a UI for changing the Static PIN given a card form-factor. This API can only be used once the Static PIN is set. The UI is in accordance with the theme with which the SDK has been configured. The UI comprises of three input fields where we can enter:

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

Users can update the Static by providing the correct Old PIN and valid new PIN. The UI also provides validations for:

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

Here is the code snippet for the same:

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

Cards SDK exposes this API to expose the Block Card functionality. The user can use this API to block the card temporarily. The user may unblock the card in future if required.

Here is the code snippet for the same.

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

Cards SDK also provides a UI for blocking the card. The UI is in accordance with the theme with which the SDK has been configured. The UI adds a translucent black background on the existing screen and shows a snackbar containing the option to either cancel or Block the card.

Here is the code snippet for the same.

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

Cards SDK exposes this API to expose the unblock Card functionality. The user can use this API to block the card temporarily. The user may unblock the card in future if required.

Here is the code snippet for the same.

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

Cards SDK also provides a UI for unblocking the card. The UI is in accordance with the theme with which the SDK has been configured. 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.

Here is the code snippet for the same.

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

Card SDK provides the functionality to copy the un-masked card number. On success, it shows a toast message with the card number. Post that, you can paste the card number where-ever required.

Here is the code snippet for the same.

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

Cards SDK provides a full equipped front face card UI. This is a full UI for all the features provided by SDK cards. This UI supports multiple customisations and can be completely designed and changed from as per client requirement.

Here is a code snippet.

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

Ensure that you logout the user by calling this API when you want to switch a user or the user logs out from the app. Failing to do this, the SDK may behave erratically later on. Here is code snippet for the same.

Here is the code snippet for the same.

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 exception 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

Error Codes Meaning
Undefined 1001
TenantAuthFailed 1002
SDKAuthFailed 1003
RegisterError 1004
InitializationError 1005
SecureStoreSetUpError 1006
GetCardError 1007
ResourceParsingError 1008
ResourceNotFoundError 1009
UserCancellationError 1010
BadRequestError 1011
ResourceConflictError 1012