Non-Seamless Flow - iOS

The Tridentity SDK will handle the GUI and business logic. These Integration steps will be applicable for banks who are on Native Framework.

1. SDK Integration

Embed SDK

  1. Drag the TridentitySDK.xcframework into your Xcode project.
  2. Link the framework:
  • Select your project target.
  • Navigate to General > Framework, Libraries, and Embedded Content.
  • Choose Embed & Sign.
  1. Integrate Firebase if push notifications are required.

Add Pod Dependency

Add the following pods and run pod install:

pod 'PayUIndia-Analytics', '~> 4.0'
pod 'PayUIndia-CrashReporter', '~> 4.0'

Permissions Required

Permission

Description

Location optional

For location-based services

Push Notification mandatory

Required for transaction notifications

2. Configuration of SDK

Set up the necessary client details within the SDK. The SDK will perform essential security checks, and if any validation fails, a callback will provide specific error codes and messages. In such cases, terminate the enrollment flow to ensure security compliance.

Parameters

Parameter

Description

clientId mandatory

Client ID provided through offline channels

environment optional

Can be set to "UAT" (default) or "PROD"

themeConfig optional

Optional theme configuration in JSON/dictionary format

Code Example

let configData: [String: Any] = ["clientId": "yourClientId", "environment": "UAT", "themeConfig": themeConfig]
TridentitySDKInterface.shared.configSDK(jsonObject: configData) { success, response in
if success {
print("SDK configured successfully: \(response)")
} else {
print("Configuration error: \(response)")
// Terminate the enrollment flow
}
}

Sample Responses

Success Response:

["code": 200, "message": "SDK configured successfully"]

Failure Response:

["code": 10, "message": "Push notifications are disabled"]

3. Implement TridentSDKDelegate

Ensure that your class adopts the TridentSDKDelegate protocol to handle callbacks for various SDK interfaces, with the exception of the customer status check. This implementation is crucial for processing SDK responses and updates effectively.

Sample Code

extension YourClass: TridentSDKDelegate {
func fetchStatus(data: [String: Any]) {
if let statusCode = data["code"] as? Int {
switch statusCode {
case 200:
// Handle success
case 400:
// Handle API/network failure
default:
// Handle other errors
}
}
}

func showCustomerStatus(data: [String: Any]) {
if let statusCode = data["code"] as? Int {
switch statusCode {
case 200:
// Handle success
case 400:
// Handle API/network failure
default:
// Handle other errors
}
}
}

func sdkStatusUpdate(data: [String: Any]) {
if let statusCode = data["code"] as? Int,
let dataKey = data["dataKey"] as? String {
switch dataKey {
case "registerFCMData":
if statusCode == 200 {
// Handle successful FCM token registration
}
case "historyData":
if statusCode == 200 {
// Process the successfully retrieved transaction history
}
case "deregistrationData":
if statusCode == 200 {
// Handle successful customer deregistration
}
default:
// Handle other data keys
}
}
}
}

4. Register FCM

To enable push notifications for transaction processing, you need to register the FCM token. This should be done whenever the FCM token is refreshed.

Parameters

Parameter

Description

fcmToken mandatory

Token generated by Firebase Messaging Service

statusDelegate mandatory

The class implementing TridentSDKDelegate

Code Example

TridentitySDKInterface.shared.registerFCM(fcmToken: fcmToken, statusDelegate: self)

Sample Response

{
"dataKey": "registerFCMData",
"status": "SUCCESS",
"code": 200,
"message": "Successfully Updated FCM token"
}

5. Handling User Registration

The initiateRegistration method in the TridentitySDKInterface is used to manage user registration.

Parameters

Parameter

Description

jsonObject mandatory

Dictionary containing registration parameters (e.g., mobileNumber)

presenter mandatory

UIViewController to present the registration interface

completionHandler mandatory

Closure to handle registration result

Code Example

let userDetails: [String: Any] = ["mobileNumber": "user'sMobileNumber"]

TridentitySDKInterface.shared.initiateRegistration(jsonObject: userDetails, presenter: viewController) { success, response in
if success {
print("User registered successfully")
} else {
print("Registration failed: \(response)")
}
}

6. Check Customer Status

Use this method to obtain the registration status of a customer within the Tridentity System. Ensure that you prepend the mobile number with "91".

Device Identification

You may need to pass the device identifier to various SDK methods for registration status.

let uid = UIDevice.current.identifierForVendor?.uuidString

Code Example

let json: [String: Any] = ["mobileNumber": "91***", "uid": "####"]

TridentitySDKInterface.shared.checkRegistrationStatus(jsonObject: json, completionHandler: {})

Sample Response

["subParam": {
customerStatus = "registration_comm_success";
}, "message": "Customer status retrieved", "status": "SUCCESS", "code": 200]

Registration Status Handling

  • Successful Registration: The status customerStatus: registration_comm_success indicates a successful registration.

  • Successful Registration with Activation Delay: Status values like registration_comm_11_fail mean registration is successful, but services activate within 24 hours.

  • Failure: Any other status indicates registration failure.

7. Transaction History

To retrieve transaction data, invoke the method with optional limit and offset parameters.

  • Offset (Page Number): Specifies the page number. An offset of 0 fetches the first records.
  • Limit (Number of Records per Request): Maximum records returned per page. A limit of 10 retrieves up to 10 records.

Defaults and Constraints:

  • Defaults are 10 for limit and 0 for offset.
  • Maximum limit is 50.

Examples:

  • First Page: offset: 0, limit: 10 - Retrieves the first 10 records.
  • Second Page: offset: 1, limit: 10 - Retrieves records 11 through 20.

Adjust parameters to efficiently page through transaction records.

Parameters

Parameter

Description

limit optional

Number of records per request (default 10, max 50)

offset optional

Page number to retrieve (0-based, default 0)

statusDelegate mandatory

The class implementing TridentSDKDelegate

Sample Code

let param: [String: Any] = ["limit": 5, "offset": 0]

TridentitySDKInterface.shared.fetchTransactionHistory(jsonObject: param, statusDelegate: self)

Sample Response

{
"code": 200,
"subParam": {
"offset": 0,
"totalCount": 21,
"txnHistory": [
{
"amount": 23,
"authType": "PUSH",
"expiryTime": 1721177553000,
"merchant": "Amez standard QA 111306",
"reason": "RazyPay Transaction Request of Rs: 23 at Amez standard QA 111306",
"status": "EXPIRED",
"timeStamp": 1721177493000,
"title": "",
"txnId": "c12b2487-cc65-4c9f-b31a-f60731ece16a"
}
]
},
"status": "SUCCESS",
"message": "Successfully retrieved txn-history",
"dataKey": "historyData"
}

8. Process Transaction

Upon receiving an FCM notification, use this method to process the transaction status based on the authentication action:

Parameters

Parameter

Description

notificationInfo mandatory

Dictionary with the notification payload

presenter mandatory

View controller to present the transaction UI

Code Example

Example Payload:

let notificationInfo: [AnyHashable: Any] = [
"aps": ["alert": "You have a new message!", "badge": 1],
"customDataKey": "customValue"
]
TridentitySDKInterface.shared.processTransaction(notificationInfo: notificationInfo, presenter: viewController)

Important Notes

Expiration: The transaction expires 60 seconds after receipt, so timely processing is crucial.

9. De-Registration

To remove a customer's registration from the system, use the following method:

Parameters

Parameter

Description

statusDelegate mandatory

The class implementing TridentSDKDelegate

Code Example

TridentitySDKInterface.shared.deRegisterUser(statusDelegate: self)

Sample Response

["dataKey": "deregistrationData", "message": "Device Deregistered Successfully", "status": "SUCCESS", "code": 200]

10. Callback Success/Error Codes

The table lists possible callback success and error codes, and their reasons:

CodeReason
300Biometric authentication disabled due to changes in device biometric settings. Please re-register to continue payments without OTP
301Biometric Authentication failed. Limit exceeded due to incorrect attempts
302Device is not compatible for biometric authentication. Please try registration from another device.
303Biometric is disbaled. Please enable the same to register for biometric authentication
304Too many biometric attempts. Please wait or use PIN/password to unlock.
305Biometric authentication disabled due to app reinstallation or data deletion. Please re-register to continue payments without OTP
306Invalid mobile number. Please enter a valid number.
307SDK not configured. Please initialize the SDK with valid configuration parameters before making API calls.
308Invalid parameters provided. Please check your input and try again.
331Device Debugging detected. For security, please disable to proceed.
333Biometric authentication disabled due to changes in device security settings. Please re-register to continue payments without OTP
334Screen recording observed.
335App toggling observed. Please try registration again
336Device is reverse engineered
338Customer not registered. Please complete the registration process to continue.
361No network connection available. Please check your internet connection and try again
362Biometric authentication has timed out. Redirecting to OTP authentication
363Biometric authentication timed out. Please try in future Payments again to enrol for biometric
364The system timed out the SDK session after a period of app inactivity.
365Unable to send SMS. Please check your phone number and network connection, then try again later.
367Device is in airplane mode. Please turn off airplane mode and try again
370SMS sending cancelled. Please try registering again later.SMS sending cancelled. Please try registering again later.
371Unable to send SMS. Please try registering again later.
372Cannot present registration screen. Invalid navigation view controller argument.
373Unable to process server response.
390Biometric authentication disabled due to sim movement. Please re-register to continue payments without OTP
400We encountered an error loading this page. Please try again.
200Configuration Successful