Getting started

UI SDK

Before we start we need to go through a couple of preparation steps in order to initialise the SDK. We also provide a quick Intro on how to make our network calls work. This will help you to understand the differences in the relevant use-cases.

Setup

In order to use the Karhoo UI SDK, you need to add it to your project as a dependency and configure it. This will be done in your build.gradle in the root directory if you are on Android or in the podfile for your iOS project. You can find instructions on how to do this below.

Android

The Karhoo Android SDK is compatible with Android 5.0 Lollipop and above.

Ensure that you have added your Google Maps API key (google_maps_api_key) to your app-level manifest file within your application tag:
You can add the Google Maps API key to your string resources and use it in the manifest file
@string/google_maps_api_key

// Add the following into your app level AndroidManifest
<meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="${google_maps_api_key}" />

Add the following to your root level build.gradle file:

// Add the following into your root level build.gradle
allprojects {
    repositories {
        ... // Other maven repos for your project
        maven { url 'https://jitpack.io' }
        maven {
            url "https://cardinalcommerceprod.jfrog.io/artifactory/android"
            credentials {
                username 'braintree_team_sdk'
                password 'AKCp8jQcoDy2hxSWhDAUQKXLDPDx6NYRkqrgFLRc3qDrayg6rrCbJpsKKyMwaykVL8FWusJpp'
            }
        }
    }
}

Depending on the payment provider that you wish to integrate with, we offer three dependencies, each one containing a different payment provider integration. Only one of them should be used when adding the UISDK to your project

dependencies {
    ...// Other project dependencies

    //The -adyen dependency contains the Adyen integration:
    implementation 'com.github.karhoo.karhoo-android-ui-sdk:uisdk-adyen:1.7.0'

    //The -braintree dependency contains the Braintree integration:
    implementation 'com.github.karhoo.karhoo-android-ui-sdk:uisdk-braintree:1.7.0'

    //The -full dependency contains both payment providers and it's up to you which payment provider you shall use:
    implementation 'com.github.karhoo.karhoo-android-ui-sdk:uisdk-full:1.7.0'

    //Note that only one dependency from the above three should be integrated into your project
}

🚧

Deprecated

For older versions than 1.6.1, add the following to your app level build.gradle file:

implementation 'com.github.karhoo:karhoo-android-ui-sdk:1.5.6'

Pro-guard Configuration

-keep class com.karhoo.** { *; }
-keep class com.braintreepayments.** { *; }
-keep class com.adyen.** { *; }

-keep class com.google.android.gms.maps.** { *; }

-keepnames class * implements java.io.Serializable
-keepclassmembers class * implements java.io.Serializable{
static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    !static !transient <fields>;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

iOS

The Karhoo iOS UI SDK is compatible with iOS 12 and above.
Please note: 1.9.x is the last iOS UI SDK version to support iOS 12.

Cocoapods

Add the following to your podfile:

use_frameworks!
pod 'KarhooSDK', '1.6.3'
pod 'KarhooUISDK', :git => '[email protected]:karhoo/karhoo-ios-ui-sdk.git', :tag => '1.9.0'

#Depending on the payment provider you want to use in your integration add:
pod 'KarhooUISDK/Adyen', :git => '[email protected]:karhoo/karhoo-ios-ui-sdk.git', :tag => '1.9.0'
#or
pod 'KarhooUISDK/Braintree', :git => '[email protected]:karhoo/karhoo-ios-ui-sdk.git', :tag => '1.9.0'

Import 'KarhooUISDK' wherever you want to access Karhoo services

Swift Package Manager

🚧

KarhooUISDK is released as a Swift Package beginning with version 1.8.0

Use URL for repository: https://github.com/karhoo/karhoo-ios-ui-sdk

You will find 3 available packages:
KarhooUISDK: only core package,
KarhooUISDKAdyen: core + Adyen payment provider
KarhooUISDKBraintree: core + Braintree Payment Provider

Add the KarhooUISDK package along with one or both of the payment providers depending on your needs.

Import 'KarhooUISDK' wherever you want to access Karhoo services

📘

Flutter Integration

iOS
If you are developing a flutter app you need to allow static linking by adding the following in your Podfile

use_frameworks! :linkage => :static

This command is available in Cocoapods 1.9+

Android:

  • You may require to update your package name If your package contains underscores.
  • Ensure you assign a theme to your application in your manifest.

What’s Next