ZSKit
final public class ZSKit : NSObject
The SDK will facilitate purchase with the app store. Any new purchase or changes to existing subscription will be automatically synced to your Zoho Billing organisation and will reflect in your metrics.
-
Call this method to initialize ZSInAppPurchaseKit. This is a one time initialization and has to be done before accessing other methods from the SDK.
Declaration
Swift
public class func initialize(configuration: ZSConfiguration)Parameters
configurationThis configuration class contains the basic data used to make API calls to Zoho Billing’ server.
-
This method is used to get the array of plans that are applicable to the user. The resulting array will contain the plans that are active in both the app store and Zoho Billing. if you wish to block purchase of a particulate plan, you can mark it as inactive in Zoho Billing Dashboard.
Declaration
Swift
public class func getPlans(customFilters: [ZSCustomFieldFilter] = [], useCache: Bool = false, completion: @escaping ZSPlansHandler)Parameters
customFiltersAn optional array of custom field filters used to filter plans. Each filter must include the API name of the custom field and the value to match. For example, if you have a custom field named “Supported Countries” with the custom field’s API name
cf_supported_countries, and you want to filter by “India”, you can pass:[ZSCustomFieldFilter(fieldAPIName: "cf_supported_countries", filterValue: "India", matchType: .contains)]useCacheWhen
true, fetches data from cache server for faster response. Whenfalse, makes a live server call for the most up-to-date data. Defaults tofalse.completionReturns array of applicable plans. It will returns an empty array if there are no active plans in Zoho Billing or the App Store. If the call to subscription server or app store fails, it returns an error in the completion block.
-
This method is used to get the array Products from app store for given produt ids.
Declaration
Swift
public class func getStoreKitProducts(productIDs: [String], completion: @escaping ZSSKProductsHandler)Parameters
productIDsThe list of product ids that need to be fetched from app store.
completionReturns array of Product objects. If the call to app store fails, it returns an error in the completion block.
-
getStoreKitProducts(productIDs:Asynchronous) This method is used to get the array Products from app store for given produt ids.
Declaration
Swift
public class func getStoreKitProducts(productIDs: [String]) async -> Result<[Product], ZSError>Parameters
productIDsThe list of product ids that need to be fetched from app store.
Return Value
Returns array of Product objects. If the call to app store fails, it returns an error as result.
-
This method initiates the purchasing process for the product passed as parameter. After user confirms the purchase, the in app purchase receipt gets validated in Zoho Billing’s server. Then a new subscription is created in Zoho Billing if the user does not have any existing subscription running. In case the user already has an existing subscription, the current subscription will be upgraded or downgraded based on the current subscription.
Declaration
Swift
public class func initiatePurchase(product: Product, prmotionalOfferDetails: ZSPromotionalOfferSignature? = nil, customFields: [ZSCustomField] = [], completion: @escaping ZSPurchaseHandler)Parameters
productThe SKProduct of the plan selected by the user. It is provided in the
ZSPlanobject that you have got from the getPlans method.completionIt will return the Subscription Info of the newly created/updated subscription. If the call to subscription server or app store fails, it returns an error in the completion block.
-
If a subscription is active in App Store and yet to be synced in Zoho Billing, this method can be called. This method can be called while the user clicks on the ‘Restore’ button from the subscription screen.
Declaration
Swift
public class func restorePurchase(customFields: [ZSCustomField] = [], completion: @escaping ZSPurchaseHandler)Parameters
completionIt will return the Subscription Info of the newly synced subscription. If the call to subscription server or app store fails, it returns an error in the completion block.
-
This method will sync every one of the current subscriptions to Zoho Billing. If a subscription is active in App Store and yet to be synced in Zoho Billing, this method can be called. This method can be called while the user clicks on the ‘Restore’ button from the subscription screen. This will restore the subscription if not already synced. If already synced this will throws error mentioning that the purchase is already synced and throws if no active purchase available.
Declaration
Swift
public class func restoreAllPurchases(customFields: [ZSCustomField], completion: @escaping ZSRestorePurchaseHandler)Parameters
completionIt will return the Subscription Info of the newly synced subscription. If the call to subscription server or app store fails, it returns an error in the completion block.
-
If a subscription is active in App Store and yet to be synced in Zoho Billing, this method can be called. This method can be called while the user clicks on the ‘Restore’ button from the subscription screen.
Declaration
Swift
public class func restoreSubscription(transaction: ZSStoreTransaction, customFields: [ZSCustomField], completion: @escaping ZSPurchaseHandler)Parameters
completionIt will return the Subscription Info of the newly synced subscription. If the call to subscription server or app store fails, it returns an error in the completion block.
-
isUserEligibleForIntroductoryOffer(product:Asynchronous) Undocumented
Declaration
Swift
public class func isUserEligibleForIntroductoryOffer(product: Product) async -> Bool -
isUserEligibleForIntroductoryOffer(groupId:Asynchronous) Undocumented
Declaration
Swift
public class func isUserEligibleForIntroductoryOffer(groupId: String) async -> Bool -
Undocumented
Declaration
Swift
public class func isStorePurchaseAssociatedWithCurrentUser(completion: @escaping ZSUserValidateHandler) -
Undocumented
Declaration
Swift
public class func isStorePurchaseAssociatedWithCurrentUser(storeTransaction: ZSStoreTransaction, completion: @escaping ZSUserValidateHandler) -
getCurrentEntitlements()AsynchronousUndocumented
Declaration
Swift
public class func getCurrentEntitlements() async -> [ZSStoreTransaction] -
Sets the delegate for
ZSKit. Setting this delegate will enable the app to receive info about promocode applied in App Store. Once the promo code applied info is received, the SDK will intimate the app via a this delegate.Declaration
Swift
public class func setDelegate(delegate: ZSKitDelegate)Parameters
delegateThe Delegate will be responsible for handling promotional product purchases and changes in subscription details.
-
Clear the user information from the sdk on sign out using this method.
Declaration
Swift
public class func clearUserInfo()
Install in Dash