First steps - iOS

Initialize the DEUNA iOS SDK in your application.

The DEUNA SDK is compatible with projects using UIKit or Swift UI.

📘

Stable version: 2.12.1

Requirements

Review the requirements for using the SDK.

To use the DEUNA iOS SDK, you must have:

  • Knowledge of iOS development with Swift or Objective-C.
  • An active DEUNA account.
  • Valid DEUNA credentials.
  • Minimum configuration required for your iOS project:
    • Support for Swift 5.8.
    • Xcode version 16.0+.
📘

If you experience any delays in obtaining your credentials, then contact [email protected].

1. Install the SDK

There are two ways to install the iOS SDK:

  • Swift Package Manager (recommended)
  • Cocoapods
🚧

Follow security and privacy practices when handling user financial information.

Swift Package Manager installation

Add the SDK to your project:

  1. Go to Xcode.
  2. Go to File and choose Add Package Dependencies.
  3. In the modal window, enter the repository URL and add the package to your project.
https://github.com/deuna-developers/deuna-sdk-ios

When the "Choose Package Products" dialog appears, select only DeunaSDK and add it to your target. Set all other products (DeunaSDKCybersource, DeunaSDKKount, DeunaSDKRiskified, DeunaSDKSift, DeunaSDKSignifyd) to None.

📘

Note: The additional products (DeunaSDKCybersource, DeunaSDKKount, DeunaSDKRiskified, DeunaSDKSift, DeunaSDKSignifyd) are only required if your integration uses fraud fingerprinting. Add the specific product that matches your fraud provider — each one links a third-party framework to your app binary. If you don't use fraud detection, keep them all set to None.

Cocoapods instalation

Install the DEUNA SDK with Cocoapods if your iOS project doesn't support Swift Package Management.

  1. Write native modules for React Native or Platform Channels for Flutter.
  2. In your Podfile file, add the DeunaSDK dependency.

Example

# Specify the minimum iOS deployment target
platform :ios, '14.0' 

target 'DeunaSdkDemo' do
  use_frameworks! # Enable dynamic frameworks

  pod 'DeunaSDK', '~> 2.12.1' # Add DeunaSDK dependency
end
  1. Disable ENABLE_USER_SCRIPT_SANDBOXING in Xcode.
  2. Go to Build Settings and search for User Script Sandboxing.
  3. Set the User Script Sandboxing value to No.

2. Initialize the SDK

import DeunaSDK

To use the SDK, you have two options:

Initializing the SDK globally**

DeunaSDK.initialize(
  environment: .sandbox, // Test (.sandbox) or production (.production) environments
  publicApiKey: "YOUR_PUBLIC_API_KEY", // DEUNA public API key
	useMainThread: true // Required for Expo apps
)

By initializing the SDK in this way, you can use it anywhere in the app by:

DeunaSDK.shared.initPaymentWidget(...)

// Using variable
let deunaSdk = DeunaSDK.shared
deunaSdk.initPaymentWidget(...)

Creating an instance with the DeunaSDK class.

let deunaSDK = DeunaSDK(
  environment: .sandbox, // Testing (.sandbox) or production (.production) environment
  publicApiKey: "YOUR_PUBLIC_API_KEY", // DEUNA public key
	useMainThread: true // Required for Expo apps
)

When you create the SDK instance, you can use it through the assigned variable

deunaSDK.initPaymentWidget(...)
📘

The SDK initialization mode will depend on the App structure.


4. Choose the integration component

Mobile SDKs support the following components:

📘

The iOS SDK uses the ViewController parent (topViewController orrootViewController) from your app to show a modal with the respective widget.