iOS SDK Installation
This page covers how to install the Dapi SDK in your iOS application
Steps To Add Dapi To Xcode Project
1. Get Your API Key AppKey
- To start using Dapi APIs, log in or create an account at Dashboard.
- Follow instructions about getting your AppKey.
2. Set up Backend Server
-
Important! Using the SDK requires configuring a backend server. Read more about the flow and requirements: Server set-up for SDKs. For development purposes, the server can be easily set up on your local machine.
-
Once the server runs successfully, make sure to add the host URL as
App Server URL
on the Dapi Dashboard
Now the SDK will automatically know where to send its requests!
3. Add Project Bundle ID to Dashboard
- Open your .xcodeproj file
- Copy the value of Bundle Identifier
- Open your app in the Dashboard.
- Select your Application → Go to App Settings
- Click on the Bundle IDs + icon, paste the Bundle ID value, and click Submit
Install Dapi SDK into the Xcode project
Cocoapods Installation
To integrate Dapi into your Xcode project using CocoaPods, add to your Podfile
:
pod 'DapiBanking'
Then, run the following command:
$ pod install
Swift Package Manager
- Open project target.
- Select Swift packages
- Add a New package and paste https://github.com/dapi-co/Dapi-iOS
- Make sure to be on the latest version.
Manual Installation
- Download the latest Dapi SDK from release assets
- Extract or unzip the file
- Drag & drop
DapiSDK.xcframework
to your project’s “Frameworks, Libraries, and Embedded Content” section - Under the “General” tab, make sure that the “Copy items if needed” checkbox is checked
Usage
- Import DapiSDK in your app delegate
import DapiSDK
@import DapiSDK;
- Add the following to your app delegate's application:didFinishLaunchingWithOptions: method.
Dapi.shared.start(appKey: "#app_key#",
environment: "#environment#", //.sandbox or .production
clientUserID: "#client_user_id#")
[Dapi.shared startWithAppKey:@"#app_key#"
environment: DAPIEnvironmentSandbox
clientUserID:@"#client_user_id#"
completion:^(Dapi * _Nullable dapi , NSError * _Nullable error) {
NSLog(@"[DAPI] Error: %@", error.dapiErrorMessage);
}];
-
Replace
app_key
with your appKey from the first step. -
environment
value issandbox
orproduction
.production
provides access to real banks,sandbox
can be used to simulate banks' behavior in a testing environment - learn more: Get Started with Sandbox. -
ClientUserID
is used to distinguish between different end-users. The value forclientUserID
needs to be set by you. We recommend settingclientUserID
to your actual user ID that you use to distinguish between users.
- Run your application and check the console, you should be able to see the following:
Congratulations! Now you can use Dapi in your iOS project!
Updated 9 months ago