alt text

ZSInAppPurchaseKit

You can bundle our SDK with your iOS apps. The SDK’s will facilitate purchase with the respective app stores. Any new purchase or changes to existing subscription will be automatically synced to your Zoho Billing organisation and will reflect in your metrics.

Installation

CocoaPods

To install ZSInAppPurchaseKit in your XCode project using cocoapods, add the below lines in your Podfile.

use_frameworks!

target '<YOUR_TARGET>' do
    pod 'ZSInAppPurchaseKit', '1.0.0'
end

Then run pod install command in terminal from your project directory.

$ pod install

ZSInAppPurchaseKit.xcframework

If you are not using Coocapods in your project you can download and add our ZSInAppPurchaseKit.xcframework in to your project.


Implementation

Initalization

let zsConfiguration = ZSConfiguration(apiKey: YOUR_API_KEY, zsProductId: YOUR_PRODUCT_ID, domain: DOMAIN)
    zsConfiguration.setUserInfo(userId: APP_USER_ID, email: APP_USER_EMAIL, displayName: APP_USER_DISPLAY_NAME)
    ZSKit.initialize(with: zsConfiguration)

Get Plans

    ZSKit.getPlans
    { (plans, error) in
        //Show the UI with plans list.
    }

Initiate Purchase

    ZSKit.initiatePurchase(product: USER_SELECTED_PRODUCT)
    { (subsDetail, error) in
        //Subscription Handling Code goes here
    }

Clear User Info

    //Clear the user information from sdk on the sign out using this method.
    ZSKit.clearUserInfo()