OceanLabs / iOS-Print-SDK

iOS Print SDK. Easily add print on demand functionality to your app within minutes! Print Postcards, Magnets, Photo Prints, Posters, Stickers, T-Shirts, PhotoBooks, etc.
https://www.kite.ly
111 stars 33 forks source link
e-commerce ecommerce photo-book photobook print prints sdk shop shopping

iOS SDK

Kite

Platform Cocoapods Twitter

The Kite SDK makes it easy to add print on demand functionality to your app.

Harness our worldwide print and distribution network. We'll take care of all the tricky printing and postage stuff for you!

To get started, you will need to have a free Kite developer account. Go to kite.ly to sign up for free.

Products

Use our SDK to unlock hidden revenue streams and add value for your users. In under ten minutes you could be selling:

Features

Requirements

Installation

CocoaPods

If you're using CocoaPods just add the following to your Podfile:

pod "Kite-Print-SDK"

You can also provide your own photo source (for example from within your app or a custom back end). Please read the documentation here.

You can find example projects for Swift and Objective-C.

Quick Integration

We really mean it when we say integration can be done in minutes.

Objective-C:

#import <OLKitePrintSDK.h>

Swift:

import KiteSDK

Objective-C:

[OLKitePrintSDK setAPIKey:@"YOUR_API_KEY" withEnvironment:OLKitePrintSDKEnvironmentLive]; //Or OLKitePrintSDKEnvironmentSandbox for testing

Swift:

OLKitePrintSDK.setAPIKey("YOUR_API_KEY", with: .live) //Or .sandbox for testing

Read about SCA (Strong Customer Authentication) requirements here.

Add a URL Scheme to your info.plist:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>myappname123456</string>
        </array>
    </dict>
</array>

Pass the URL Scheme you defined to the Kite SDK:

Objective-C:

[OLKitePrintSDK setUrlScheme:@"myappname123456"];

Swift:

OLKitePrintSDK.urlScheme = "myappname123456"

Implement the following method in your app delegate:

Objective-C

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    return [OLKitePrintSDK handleUrlCallBack:url];   
}

Swift:

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    return OLKitePrintSDK.handleUrlCallBack(with: url)
}

Objective-C:

OLKiteViewController *vc = [[OLKiteViewController alloc] initWithAssets:@[[OLAsset assetWithURL:[NSURL URLWithString:@"https://psps.s3.amazonaws.com/sdk_static/4.jpg"]]]];
[self presentViewController:vc animated:YES completion:NULL];

Swift:

let kiteViewController = OLKiteViewController.init(assets: [OLAsset(url: URL(string: "http://psps.s3.amazonaws.com/sdk_static/4.jpg"))])
present(kiteViewController!, animated: true, completion: nil)

💰💵💶💷💴

iOS Security (ATS)

iOS includes a security feature called App Transport Security. In order to connect to the Kite servers you will need to add some exceptions to your project's info plist file. We need to add forward secrecy exceptions for Amazon S3 (which Kite uses) and PayPal (optional). The following is what you need to copy your app's info plist:

    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>paypal.com</key>
            <dict>
                <key>NSExceptionRequiresForwardSecrecy</key>
                <false/>
                <key>NSIncludesSubdomains</key>
                <true/>
            </dict>
            <key>amazonaws.com</key>
            <dict>
                <key>NSExceptionRequiresForwardSecrecy</key>
                <false/>
                <key>NSIncludesSubdomains</key>
                <true/>
            </dict>
        </dict>
    </dict>

There are a few more entries to add if you opt for Facebook and Instagram integration as mentioned above. More info here.

Use Cases

The Print SDK supports two primary use cases: Kite Print Shop Experience, and Custom User Experience.

Kite Print Shop User Experience

Kite

The Kite SDK includes a robust product selection, photo editing and payment experience that's proven to convert well with users. It can take care of everything for you, no need to spend time building any user interfaces.

This is the quickest approach to integration and perfect if you don't want to spend a great deal of time building a custom experience. You can be up & running within minutes!

To use our Print Shop experience:

  1. Create and present (or push) an OLKiteViewController passing it an array of photos, we'll do the rest.
  2. Register your payment details with us so that we can pay you when your users place orders

Custom User Experience

You can build your own UI if you don't want to use or customize the provided Print Shop experience. You can still use the Print SDK to handle the print order creation and submission:

  1. Create print jobs representing the product(s) you wish to have printed and posted
  2. Checkout for the order and submit it to our servers for printing and posting

Credentials & Environments

Your mobile app integration requires different API Keys values for each environment: Live and Test (Sandbox).

You can find these Kite API credentials under the Credentials section of the development dashboard.

Sandbox

Your Sandbox API Key can be used to submit test print orders to our servers. These orders will not be printed and posted but will allow you to integrate the Print SDK into your app without incurring cost. During development and testing you'll primarily want to be using the sandbox environment to avoid moving real money around. To test the sandbox payment you can use your own PayPal sandbox account or contact us at hello@kite.ly

When you're ready to test the end to end printing and postage process; and before you submit your app to the App Store, you'll need to swap in your live API key.

Live

Your Live API Key is used to submit print orders to our servers that will be printed and posted to the recipient specified. Live orders cost real money. This cost typically passed on to your end user (although this doesn't have to be the case if you want to cover it yourself).

Logging in to our Developer Dashboard allow's you to dynamically change the end user price i.e. the revenue you want to make on every order. Payment in several currencies is supported so that you can easily localize prices for your users. The dashboard also provides an overview of print order volume and the money you're making.

ApplePay

See our ApplePay setup documentation if you want to enable checkout via ApplePay.

SDK Entry Points

Depending on your use case you might want to launch to a specific product, or even bypass the product selection/creation process entirely and jump straight to the checkout/payment journey. See our SDK entry point documentation for more details.

Documentation

Print API

We also have a REST print API for those who prefer to invent wheels :)

Migration from older Kite SDK versions

Please see the Migration Documentation to migrate to newer versions

Open Source Acknowledgements

The iOS Print SDK uses software created by the Open Source community, you can find a full list of acknowledgements here.

License

Kite iOS Print SDK is available under a modified MIT license. See the LICENSE file for more info.