Skip to main content

Usage

Initialize

Initialize sdk and make it ready to use Import Amani sdk in class

import AmaniUI
import AmaniSDK

Create CustomerRequestModel for amani sdk.

Parameter NameDescriptionTypeNeed to set
idCardNumberCUSTOMER ID CARD NUMBERStringYes
nameCUSTOMER NAMEStringNo
emailCUSTOMER EMAILStringNo
phoneCUSTOMER PHONE NUMBERStringNo
let customerModel = CustomerRequestModel(name: "CUSTOMER_NAME", email: "CUSTOMER_EMAIL", phone: "CUSTOMER_PHONE_NUMBER", idCardNumber: "CUSTOMER_ID_CARD")
  1. Initializing AmaniSDK with sharedInstance
let amaniUI = AmaniUI.sharedInstance
  1. Set delegate for viewController
amaniUI.setDelegate(delegate: self)
extension ViewController:AmaniUIDelegate {

func onError(type: String, Error: [AmaniSDK.AmaniError]) {
print(type, Error)
}

func onKYCSuccess(CustomerId: String) {
print("onKYCSuccess", CustomerId)
}

func onKYCFailed(CustomerId: String, Rules: [[String : String]]?) {
print("onKYCFailed", CustomerId, Rules)
}

}
  1. Set server parameters and customerModel

If dont want to use location permissions please provide with useGeoLocation parameter

amaniSDK.set(server: "SERVER_URL", token: "TOKEN", customer: customer,useGeoLocation: false)

Select showing language with language parameter

amaniSDK.set(server: "SERVER_URL", token: "TOKEN", customer: customer,language: "tr")

You can also set all parameters like this

amaniSDK.set(server: "SERVER_URL", token: "TOKEN", customer: customer,useGeoLocation: false,language: "tr")

If you've been told by Amani to use the v1 API, you can set it as shown below (default is v2)

      amaniUI.set(server: "SERVER_URL", token: "TOKEN", customer: customer,language: "tr", apiVersion: .v2)
  1. Start the SDK
amaniUI.showSDK(on: self) {[weak self](customer, error) in
if let error = error {
fatalError(error.localizedDescription)
} else {
print(customer)
}
}

Example of KYC usage

import UIKit
import AmaniUI
import AmaniSDK

class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

// Customer login information
let customerModel = CustomerRequestModel(name: "CUSTOMER_NAME", email: "CUSTOMER_EMAIL", phone: "CUSTOMER_PHONE_NUMBER", idCardNumber: "CUSTOMER_ID_CARD")
// Initialize SDK
let amaniUI = AmaniUI.sharedInstance
// Configure SDK
amaniUI.setDelegate(delegate: self)

amaniUI.set(server: serverURL, token:"TOKEN", customer: customer,language: "tr", apiVersion: .v2)

amaniUI.showSDK(on: self) {[weak self](customer, error) in
if let error = error {
fatalError(error.localizedDescription)
} else {
self?.amaniUI.showSDK(on: self!)
}
}
/*
if dont want to use location permissions please provide with useGeoLocation parameter
amaniSDK.set(server: "SERVER_URL", token: "TOKEN", customer: customer,useGeoLocation: false)

select showing language with language parameter
amaniSDK.set(server: "SERVER_URL", token: "TOKEN", customer: customer,language: "tr")


amaniSDK.set(server: "SERVER_URL", token: "TOKEN", customer: customer,useGeoLocation: false,language: "tr")
*/
}

}
extension ViewController: AmaniUIDelegate{

func onError(type: String, Error: [AmaniSDK.AmaniError]) {
print(type, Error)
}

func onKYCSuccess(CustomerId: String) {
print("onKYCSuccess", CustomerId)
}

func onKYCFailed(CustomerId: String, Rules: [[String : String]]?) {
print("onKYCFailed", CustomerId, Rules)
}
}

Acquire profile token

If you dont know hot to get profile token you need to read acquire profile token documentation.