This SDK allows you to conveniently manage your subscriptions.
To integrate using Apple's Swift package manager, add the following as a dependency to your Package.swift:
.package(url: "https://github.com/LinkFive/ios-purchases-sdk.git", .upToNextMajor(from: "1.0.0"))Then, specify "LinkFivePurchases" as a dependency of the Target in which you wish to use LinkFivePurchases.
Lastly, run the following command:
swift package updateYou need to initialize the SDK with your API KEY from the dashboard.
LinkFivePurchases.shared.launch(with: "YOUR_API_KEY")fetchSubscriptions returns a result with a list of SKProducts which have been made available through the LinkFive dashboard.
LinkFivePurchases.shared.fetchSubscriptions { result in
// TODO: Process the result
}To check if there is a current receipt and whether it's valid, use fetchReceiptInfo. It fetches the receipt info mostly from cache, but you can also force it to fetch the receipt info from the server.
LinkFivePurchases.shared.fetchReceiptInfo { result in
// TODO: Process the result
}To purchase a subscription, use purchase with a SKProduct. It returns whether the purchase has been successful.
LinkFivePurchases.shared.purchase(product: product) { result in
// TODO: Process the result
}To restore a subscription, use restore. It returns whether the restore has been successful.
LinkFivePurchases.shared.restore { result in
// TODO: Process the result
}LinkFivePurchases is released under an MIT license. See LICENSE for more information.