Project Setup

First things first, you'll need to connect your application to our OCR service using either the Client Library or REST API. This involves a few platform specific installation and configuration steps

Client Library

We recommend using our Client Library vs. plain REST API for most projects. The lightweight library automatically handles authorization, local keys, and http requests, simplifying integration time by exposing native endpoints.

Installation

Android

  • Open Your build.gradle File: Start by opening the project-level build.gradle file in your Android project.

  • Add Maven Repository: Insert the following Maven repository to ensure your project can fetch the TIKI Client Library:

    allprojects {
        repositories {
            mavenCentral()
        }
    }
    
  • Include the Client Library Dependency: Next, open your app-level build.gradle file and add the dependency for the mytiki Publish Client Library:

    dependencies {
        implementation 'com.mytiki:publish-client:1.0.0'
    }
    
  • Sync Your Project: Finally, synchronize your project with Gradle to apply the changes.

  • Camera Permissions: If your application uses the camera to scan receipts, you'll need to add the following permissions to your AndroidManifest.xml:

    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="29"/>
    

iOS

  • Ensure CocoaPods is Installed: CocoaPods is required to integrate the library. Install it using:

    sudo gem install cocoapods
    
  • Navigate to Your Project Directory: Use the terminal to go to your iOS project directory.

  • Create a Podfile: Run pod init to create a Podfile if you don't have one.

  • Add the Client Library Pod: Open your Podfile and add:

    target 'YourApp' do
      pod 'TikiClient'
    end
    

    Replace 'YourApp' with your actual target name.

  • Install Dependencies: Save the Podfile and run pod install to install your new dependencies.

  • Open Your Project in Xcode: Remember to open the .xcworkspace file to access your project post-installation.

  • Camera Permissions: For iOS, specify why the app requires camera access by adding the following to your info.plist:

    <key>NSCameraUsageDescription</key>
    <string>The camera is used to scan physical receipts.</string>
    

Capacitor

  • Install the Client Library: In your project directory, run:

    npm install @mytiki/publish-client
    
  • Include Capacitor Plugins: If your app utilizes the camera, ensure you've installed the necessary Capacitor plugins:

    npm install @capacitor/camera
    npm install @capacitor/app
    
  • Camera Permissions:

    • iOS: Add the NSCameraUsageDescription key to your info.plist.
    • Android: Ensure your AndroidManifest.xml includes camera permissions.

Configuration

Before integrating the Client Library, gather the following information:

Required

  • providerId: Your unique identifier with TIKI.
  • publicKey: Your public key provided by TIKI.
  • companyName: Your legal business name.
  • companyJurisdiction: Legal jurisdiction of your business.
  • tosUrl: URL to your Terms of Service.
  • privacyUrl: URL to your Privacy Policy.

Optional

  • gmailApIKey: Used for scraping receipts from Gmail email accounts. Omit if not used.
  • outlookApiKey: Used for scraping receipts from Outlook email accounts. Omit if not used.
val config: Config = {
  providerId: "<PROVIDER-ID>", // Provided by TIKI
  publicKey: "<PUBLIC-KEY>", // Provided by TIKI
  companyName: "ACME Inc",
  companyJurisdiction: "Nashville, TN",
  tosUrl: "https://acme.inc/tos",
  privacyUrl: "https://acme.inc/privacy",
  gmailApIKey: "<GMAIL API KEY>",
  outlookApiKey: "<OUTLOOK API KEY>
};

TikiClient.configuration(config)
let config = Config(
  providerId: "<PROVIDER-ID>", // Provided by TIKI
  publicKey: "<PUBLIC-KEY>", // Provided by TIKI
  companyName: "ACME Inc",
  companyJurisdiction: "Nashville, TN",
  tosUrl: "https://acme.inc/tos",
  privacyUrl: "https://acme.inc/privacy",
  gmailApIKey: "<GMAIL API KEY>",
  outlookApiKey: "<OUTLOOK API KEY>
)

TikiClient.configuration(configuration: config)
const config: Config = {
  providerId: "<PROVIDER-ID>", // Provided by TIKI
  publicKey: "<PUBLIC-KEY>", // Provided by TIKI
  companyName: "ACME Inc",
  companyJurisdiction: "Nashville, TN",
  tosUrl: "https://acme.inc/tos",
  privacyUrl: "https://acme.inc/privacy",
  gmailApIKey: "<GMAIL API KEY>",
  outlookApiKey: "<OUTLOOK API KEY>
};

Tikiclient.configuration(config)
import Vue from "vue";
import TikiPlugin from "@mytiki/publish-client-capacitor";

Vue.use(TikiPlugin, {
  providerId: "prov-id",
  publicKey: "pubkey",
  companyName: "ACME Inc",
  companyJurisdiction: "Nashville, TN",
  tosUrl: "https://acme.inc/tos",
  privacyUrl: "https://acme.inc/privacy",
  gmailApIKey: "<GMAIL API KEY>",
  outlookApiKey: "<OUTLOOK API KEY>
})

Initialization

After configuring the library, initialize it with the user's ID in your application:

TikiClient.initialize("<userId>")
TikiClient.initialize("<userId>")
TikiClient.initialize("<userId>")

🚧

Avoid using PII for User IDs

If your User ID is identifiable, like an email or phone number, we recommend hashing the string before initialization.

REST API

The REST API doesn't require any special setup. Just use the endpoints specified in the Client Library API reference to interact with our servers.