Freedom Pay
  1. Freedom ID
Freedom Pay
  • Overview
  • Gateway API
    • Overview
    • Sync API
      • Overview
      • Purchase
        • Overview
        • Create payment
        • Any amount
        • Card
        • 3DSecure
        • Cancel
        • Clearing
        • Refund
        • Status
      • Payout
        • Overview
        • Card
        • IBAN
        • Balance
        • Status
      • Transfer
        • Overview
        • Card
        • 3DSecure
        • Rates
        • Status
      • Card
        • Overview
        • Add
        • 3DSecure
        • List
        • Remove
        • Status
      • Token
        • Overview
        • Token Pay
        • Apple Pay
        • Google Pay
        • Token Payout
        • Status
    • Async API
      • Overview
      • create
        • create payment
        • create payment recurrent
      • read
        • read payment
        • read request
      • edit
        • edit payment.refund
        • edit payment.reverse
        • edit payment.clearing
      • delete
  • Merchant API
    • Overview
    • Purchase
      • Overview
      • Checkout
      • Card token
        • Overview
        • Tokenize card
        • Delete token
        • Card token list
        • Create payment (with CVC)
        • Confirm payment (with CVC)
        • Create payment
        • Confirm payment
      • Create payment
      • Any amount
      • Cancel payment
      • Clearing
      • Refund payment
      • Status
    • Payout
      • Overview
      • Card token
        • Tokenize card
        • Delete token
        • Card token list
        • Create payment
      • Create payment
      • IBAN
      • Balance status
      • Status by order_id
      • Status by Payment ID
      • Status
    • Mobile balance
      • Overview
      • Init
      • Pay
      • Approve
      • Resend code
      • Status
    • Invoice
      • Overview
      • Init
      • Info
      • Pay
      • Status
    • SDK
      • JS SDK
      • Google Pay
      • Freedom QR
        • Reader SDK (Android)
        • Provider SDK (Android)
      • Payment SDK
        • iOS
        • Android
    • CMS
      • Overview
      • Get Merchant ID and key
      • WordPress
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
        • Update
      • Tilda
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
      • InSales
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
      • Ecwid
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
      • Bitrix
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
      • PrestaShop
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
      • OpenCart
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
    • Redirect back
      POST
    • Result notify
      POST
    • Payout notify
      POST
    • Check request
      POST
  • Card API
    • Overview
    • Payment Cards
      • Overview
      • Dictionaries
      • Bulk issue
      • Issue card
      • Issue plastic card
      • Activate card
      • Block card
      • Unblock card
      • Set PIN
      • Reset PIN counter
      • Close card
      • Update client
      • Card info
      • Balance
      • Secret data
      • Secret data (version 2)
      • Statement
      • Statement extended
      • Create client
      • Edit client
      • Сards' list
      • Request' status
      • Create transaction
      • Clearing transaction
      • Refund transaction
      • Transaction request' status
      • Transaction info
    • Gift Cards
      • Overview
      • List
      • Issue
      • Confirm
      • Resend
      • Resend code
      • Status
  • Partner API
    • Rates
      • Overview
      • Rates
    • Products
      • Overview
      • Dictionaries
      • Add client with product
      • Request status
    • E-Money
      • Overview
      • Add
      • Owner identification
      • Info
      • Close
      • Block
      • Balance
      • Statement
      • Request Status
    • Freedom ID
      • Overview
      • Design
      • iOS SDK
      • Android SDK
      • OAuth2
        • Authorization link
        • Token exchange
        • Token refresh
        • User info
        • Request profile
        • Get profile status
        • Create user
        • Update user
      • OIDC
        • Authorization endpoint
        • Token exchange
        • Userinfo
      • Error codes
      • Examples
        • Keycloak
    • Transfer
      • Overview
      • Get token
      • Refresh token
      • Get agents
      • Fees
      • Create person
      • Create business
      • Create transfer
      • Print application
      • Confirm
      • Search
      • Payout
      • Payout confirm
      • Cancel
      • Get person info
      • Get business info
      • Status
      • Info
    • Device ID
      • Android SDK
      • iOS SDK
  1. Freedom ID

iOS SDK

Freedom ID#

Introduction
Getting Started
Prerequisites
Installation Instructions
Usage
Initialize the SDK
Authorize a User
Clear the SDK
Authorization Flow
App Initialization
Account Check
Authentication Screen Interaction
Home Screen Interaction
Request for Permissions
User Decision
Completion
Data Structures
DataGrants Structure
GrantedProfile Structure
Result Structure
TransmissionErrors Structure
NetworkError Structure
Support

Introduction#

 Welcome to the Freedom ID SDK integration guide! This guide will help you smoothly integrate the Freedom ID SDK into your iOS app, enabling secure authentication and user data permission management within the Freedom Holding ecosystem. Freedom ID serves as a single point of entry for users, ensuring top-level security and privacy while managing data permissions and accessing multiple services.
 The Freedom ID SDK is available for both Android (API level 24 and above) and iOS (12 and above) platforms. This guide specifically covers the iOS platform. Let's get started! 🚀

Getting Started#

Prerequisites#

 Before you begin integrating the Freedom ID SDK into your iOS app, ensure you have the following:
An iOS app project with a minimum iOS 12 support.
An API key provided by Freedom Pay.
The Freedom ID SDK .xcframework file provided by Freedom Pay
How to get API KEY and .xcframework file?
In order to get your API KEY and .xcframework you need to contact Freedom Pay providing the following data:
Bundle Identifier
Team ID from Apple Developer Concole

Installation Instructions#

Open Project Settings in Xcode
Select required Target
Go to General Tab and in Frameworks, Libraries, and Embedded Content and click +
Select Add Other... and then Add files...
Choose FreedomID.xcframework
Now you can import SDK and use it further

Usage#

Initialize the SDK#

 To initialize the Freedom ID SDK, call the create method of the FreedomID class. This method requires one parameter:
The API key provided by Freedom ID.

Authorize a User#

 To authorize a user, call the authorize method of the FreedomID class. This method initiates the authorization flow.
The authorize method takes three parameters:
1.
The UIViewController of your app where the authorization flow will be displayed.
2.
An array of DataGrants that the user needs to grant.
3.
A callback function that will be invoked when the authorization flow completes.
 The authorization process returns an Result object, which can be either:
.success: Contains a GrantedProfile object.
.failure: Specifies the type of error that occurred.
 Here's an example:

Clear the SDK#

 To clear the SDK, call the clear method of the FreedomID class.
 This method clears the SDK's internal state and releases any resources used during the authorization process.

Authorization Flow#

App Initialization#

 When the user opens the app, it automatically checks if there are any accounts tied to their device.

Account Check#

If an account exists: The user is navigated directly to the Home Screen, where their account(s) are displayed.
If no account exists: The user is taken to the Authentication Screen to log in. After successful authentication, the user is redirected to the Home Screen.

Authentication Screen Interaction#

 The user can log in using any of these methods:
Entering their phone number and receiving an OTP code via SMS.
Entering their email and password as credentials.
Entering their phone number and password as credentials.
 Optionally, users can enable 2FA for additional security. To enable 2FA, they need to manage their settings in their Freedom ID account on the web at https://passport.freedompay.kz

Home Screen Interaction#

On the Home screen, users see their account(s).
Users select an account for which they need to request data permissions and apply fingerprint

Request for Permissions#

After selecting an account, the app presents the Permissions Request Screen.
Users review the requested permissions (e.g., access to specific user data).

User Decision#

Permissions Granted: The host app is granted the requested permissions.
Permissions Denied: The app returns to the Home Screen or informs the user that permissions are needed to proceed.

Completion#

 Once permissions are granted, the user is notified of successful authorization, and the SDK communicates the result back to the host app.

Data Structures#

DataGrants Structure#

 This enum represents a set of permissions that a host application can request from the SDK to grant access to specific profile data.
Each constant corresponds to a particular piece of user information, allowing the host app to selectively request access based on its needs.
Below is a table describing the different DataGrants available in the Freedom ID SDK:
Enum ConstantValueDescription
readDateOfBirthread.data_of_birthGrants access to the user's date of birth
readFirstnameread.firstnameGrants access to the user's first name
readLastnameread.lastnameGrants access to the user's last name
readPatronymicread.patronymicGrants access to the user's patronymic
readCountryread.countryGrants access to the user's country
readNationalityread.nationalityGrants access to the user's nationality
readGenderread.genderGrants access to the user's gender
readIdentifierread.identifierGrants access to the user's identifier such as citizen's ID
readPhoneread.phoneGrants access to the user's phone number
readEmailread.emailGrants access to the user's email address
readPhonesread.phonesGrants access to the user's phone numbers
readEmailsread.emailsGrants access to the user's email addresses

GrantedProfile Structure#

 The GrantedProfile data class represents a user's profile information that is accessible after the required read permissions have been granted by the host application via the SDK.

Result Structure#

 The Result representing the result of an authentication process. It has two primary branches:
.success: Indicates a successful authentication with the granted user profile as its payload.
.failure: Represents various types of errors that may occur during the authentication process. Each error type is modeled either as:
An enum static cases
Or enum with associated values for cases requiring additional information.

Table 1: Result#

TypeDetails
.failureDescribes various authentication errors.
.successA successful result containing a GrantedProfile object.

Table 2: .failure contents#

TypeDetails
parsingErrorIndicates an error during parsing.
incorrectApiKeyIndicates an invalid API key.
componentValidationErrorRepresents a component validation error.
dataProcessingErrorIndicates an error in data processing.
utilityErrorRepresents a general utility error.
transmissionErrorContains a TransmissionError object.
networkErrorContains a NetworkError object.
accessDeniedIndicates access denial.
configurationErrorRepresents a configuration error.
authErrorIndicates a general authentication error.
unknownErrorRepresents an unknown error type.
userCanceledIndicates that the user cancelled the operation.
dataGrantsCanNotBeEmptyIndicates that the data grants array is empty.

TransmissionErrors Structure#

 The TransmissionErrors enum defines a set of possible errors that can occur during the transmission of requests in an authentication or communication process.
Each error represents a specific issue related to the request's structure, identification, application integrity, or the process of sending and receiving requests.

Table: TransmissionErrors#

ValueDetails
incorrectRequestStructureIndicates that the request structure is invalid or constructed incorrectly.
identificationErrorRepresents an issue with identifying the request sender.
appIntegrityErrorOccurs when the application's integrity cannot be verified.
autheticationErrorIndicates a failure in authenticating the request or sender.
requestSendingErrorRepresents an error that occurred while sending the request.
requestReceivingErrorRepresents an error that occurred while receiving the request.

NetworkError Structure#

 The NetworkError enum defines a set of possible errors that may occur during network operations.
Each error represents a specific issue, such as connection failures, stream interruptions, or problems with request/response handling.

Table: NetworkError#

TypeDescription
connectionErrorIndicates a failure to establish a network connection.
streamErrorRepresents an issue with the data stream during transmission.
codeErrorOccurs when the response contains an unexpected or invalid status code.
bodyErrorIndicates a problem with the response body, such as being incorrectly constructed or missing.
unknownErrorCaptures any unspecified or unexpected network error.

Support#

If you have questions or need help, feel free to reach out! 👋
Email: support@freedompay.kz
Previous
Design
Next
Android SDK