API Reference

Card View Native IOS Framework

Installation and Usage Guide

Installation and Usage

Card91 CardView WebView iOS Framework

Card91 Card View WebView iOS XCFramework Integration with Native iOS Apps

Description

Purpose of this document is to illustrate the method to add Card91 ‘cardwebview’ library to any iOS native application written in Swift invoked either from a ViewController or an UIView.

Card91 cardwebview library allows developers to add the webview component into their layout as per design.

Developers need to get the view onto their UIView and through invoking the viewDidLoad method with certain required parameters mentioned below and a library for viewing the card details can be utilised.

Installation

iOS Minimum Requirements :

Deployment Target version- 14.0  or above

Usage

Below steps is followed to integrate the Framework

Adding the framework

Add the xcframework file provided by us by dragging and dropping into the project's "Frameworks,Libraries, and Embedded Content’ to “Embed & Sign" section.

Importing the framework

Framework will be ready to use after it has been added into the specific project.

Create an IBOutlet of View(xib) and assign the “Card91View” class to the view in the storyboard.

Use this Card91WebView framework by importing.
Make sure not to keep any background colour of the webview since it is supposed to be transparent and keep a card background image component just behind the card webview as you wish depending on the card bank.

Initialising the CardView Webview

Get the instance of the added card91webview onto your ViewController.
As shown in the example below .
Set the Listener as given below

    @IBOutlet weak var card91View:Card91View!
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        let popView = Card91View.instanceFromNib(self,
           cardId: "******",             //Enter the cardId
           customerId: "******",         //Enter the customerId of the card
           cardLastFourDigit: "****",    //Enter the last four digits of the card
           token: "***********",         //Enter the sdkAuth Token
           nameOnCard: "*****",          //Enter the nameOnTheCard
           env: "PROD_SANDBOX",          //Enter the environment
           templateId: "******",         //Enter the templateId
           height: self.card91View.frame.height,   //Enter the Outlet frame height
           width: self.card91View.frame.width,      //Enter the Outlet frame width
           xAxis: UIScreen.main.bounds.origin.x,    //Enter the origin X-coordinates
           yAxis: UIScreen.main.bounds.origin.y)    //Enter the origin Y-coordinates
            popView.delegate = self
            self.card91View.addSubview(popView)
}

Input Parameters

NameTypeRequiredDescription
cardIdstringtruecardId which has been received form login token service (Card91 API)
customerIdstringtruecustomerId from the Card91 Login token API
cardLastFourDigitstringtruecardId which has been received form login token service (Card91 API)
tokenstringtrueAuth Token received from the Card91 APIs
nameOnCardstringtrueName of the customer to appear in the CardView
templateIdstringtrueLook and feel of the card based on templateId, By default its "xoltt"
envstringtrue"PROD" in case of production and "PROD_SANDBOX" on sandbox environment
heightdoubletrueEnter the Outlet frame height
widthdoubletrueEnter the Outlet frame width
xAxisdoubletrueEnter the origin X-coordinates
yAxisdoubletrueEnter the origin Y-coordinates

CallBack Methods

Extend the protocol WebViewListener for listening to the call back event from the webview.

Interface has below and their usage .

    func onPageFinished(message: String) {
        print(message)
    }
    
    func onPageStarted(message: String) {
        print(message)
    }
    
    func onPageError(message: String) {
        print(message)
    }
    
    func onCard91CardViewEvent(message: String) {
        print(message)
    }

onPageStarted is called when the webpage is loaded.
onPageFinished is called when webpage loading is finished .
onPageError is called when there is any error while loading the page.
onCard91CardViewEvent is called when card is initialised, detail is show, CVV is shown or copy card number event has happened.

Event callback types

The events are as follows:

Event NameDescription
C91_CARD_DETAILS_FETCH_SUCCESSCalled when the server-side APIs load successfully. At this time, the card details are available, but they will be masked if no call to action has been triggered.
C91_CARD_DETAILS_FETCH_FAILURECalled when the server-side APIs fail to load. An error message would be visible in the CardView.
C91_CARD_NUMBER_SHOWNCalled upon the successful operation of the showNumber trigger. At this time, the card number and the expiry date are un-masked and the CVV is masked.
C91_CARD_CVV_SHOWNCalled upon the successful operation of the showCVV trigger. At this time, the CVV is un-masked and the card number and the expiry date are masked.
C91_CARD_AUTHENTICATION_FAILURECall back event type when client is passing incorrect or expired auth token
C91_CARD_MISSING_PARAMETERCall back event type when client is not passing any required/blank parameter .
C91_CARD_SERVER_FAILURECall back event type when there is server service exception wit