ZSInAppPurchaseKit
通过从 Apple App Store、Google Play Store 和您的网站等多种来源同步订阅数据,获得对您的订阅业务和相关信息指标的整体视图。
Zoho Subscriptions 是一个周期性收费平台,可以帮助您管理客户订阅和相关的财务。
您可以将我们的 SDK 与您的 Android 和 iOS 应用捆绑起来。SDK 将简化与相应应用商店的交易。任何新的购买或现有订阅的变更都将自动同步到您的 Zoho Subscriptions 组织,并在您的指标中反映出来。
安装
CocoaPods
要使用 CocoaPods 在 XCode 项目中安装 ZSInAppPurchaseKit,请在 Podfile 中添加以下行。
use_frameworks!
target '<YOUR_TARGET>' do
pod 'ZSInAppPurchaseKit', '1.0.1-beta01'
end
然后在项目目录的终端中运行 pod install 命令。
$ pod install
ZSInAppPurchaseKit.xcframework
如果您项目中没有使用 CocoaPods,您可以下载并添加我们的 ZSInAppPurchaseKit.xcframework 到项目中。
实现
初始化
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)
获取计划
ZSKit.getPlans
{ (plans, error) in
//Show the UI with plans list.
}
开始购买
ZSKit.initiatePurchase(product: USER_SELECTED_PRODUCT)
{ (subsDetail, error) in
//Subscription Handling Code goes here
}
清除用户信息
//Clear the user information from sdk on the sign out using this method.
ZSKit.clearUserInfo()