InAppPurchases
Handle in-app purchases in iOS in a convenient way.
Overview
InAppPurchases covers all the basic aspects of in-app purchases in swift including purchase of a product, restore, request products, validation of receipt, auto parsing of receipt validation response and managing subscription on App Store. All the functions are available with callbacks.
Installation
InAppPurchases is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'InAppPurchases'
Usage
Create an instance of InAppPurchase Module
let inAppPurchases = InAppPurchases()
Purchase a product
inAppPurchases.purchaseProduct(productIdentifier: "Your Product ID") { success in
print(success)
}
Restore purchase
inAppPurchases.restorePurchase() { success in
print(success)
}
Request Products
inAppPurchases.requestProducts([Your ProductIDs]) { products in
for product in products {
print(product.localizedPrice())
}
}
Validate Purchase
inAppPurchases.isProductPurchased("Your Product ID", appSharedSecret: "Your app shared secret") { purchased in
print(purchased)
}
Open App Store Subscriptions Page
inAppPurchases.manageSubscriptionsOnAppStore()
Author
Umar Awais, [email protected]
License
InAppPurchases is available under the MIT license. See the LICENSE file for more info.