https://github.com/jonastillges/swiftystorekithelper
🎉Facilitates the implementation of In-App-Purchases with SwiftyStoreKit. 🎉 😍 SwiftyStoreKit Helper
https://github.com/jonastillges/swiftystorekithelper
iap iaphelper in-app-purchases ios macos purchase swift swift-language swiftystorekit
Last synced: 4 months ago
JSON representation
🎉Facilitates the implementation of In-App-Purchases with SwiftyStoreKit. 🎉 😍 SwiftyStoreKit Helper
- Host: GitHub
- URL: https://github.com/jonastillges/swiftystorekithelper
- Owner: JonasTillges
- Created: 2018-11-17T22:57:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-10T14:51:47.000Z (about 7 years ago)
- Last Synced: 2025-05-05T23:49:01.634Z (about 1 year ago)
- Topics: iap, iaphelper, in-app-purchases, ios, macos, purchase, swift, swift-language, swiftystorekit
- Language: Swift
- Homepage:
- Size: 383 KB
- Stars: 18
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SwiftyStoreKit Helper (IAPHelper)

IAPHelper makes SwiftyStoreKit even lighter. And you get more features!
# NEWS
SwiftyStoreKitHelper now supports auto-renewable Subscribtions. You can easily implement the needed Terms or product information of your IAP product. totally auto-generated
### Terms Sample:
```
Subscription price: 9,99$ Description: Premium to use all features. Free Trial: 1 Week. Subscription duration: 1 Month Please read below about the auto-renewing subscription nature of this product:
• Payment will be charged to iTunes Account at confirmation of purchase • Subscription automatically renews unless auto-renew is turned off at least 24-hours before the end of the current period • Account will be charged for renewal within 24-hours prior to the end of the current period, and identify the cost of the renewal • Subscriptions may be managed by the user and auto-renewal may be turned off by going to the user's Account Settings after purchase • Any unused portion of a free trial period, if offered, will be forfeited when the user purchases a subscription to that publication, where applicable Terms of Use: "your Terms Of Use link" Privacy Policy: "your Privacy Policy link".
```
##
## Prerequisites
1. SwiftyStoreKit
2. StoreKit
3. iOS 5 or later
### Add the "SwiftyStoreKitHelper" folder to your project.
### Important!
Install SwiftyStoreKit as a CocoaPod. https://github.com/bizz84/SwiftyStoreKit
```
pod 'SwiftyStoreKit'
```
## Set the products and sharedSecret in IAPHelper.swift
```
static let proSubscription = "ProductId"
```
```
static let sharedSecret = "yourSharedSecret"
```
### Let's get started:
Insert ```IAPHelper.startHelper()``` in your didFinishLaunchingWithOptions.
```
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
IAPHelper.startHelper()
return true
}
```
## Get Product Informations
```
IAPHelper.getProductInfo(with: IAPHelper.Product1, completed: {() -> () in
self.priceTag.text = IAPHelper.Info[0].priceString
self.productName.text = IAPHelper.Info[0].name
self.productDescription.text = IAPHelper.Info[0].localizedDescription
})
```
## Get Subscription Terms
For auto-renewable Subscriptions.
```
IAPHelper.getSubscriptionTerms(with: IAPHelper.Product1, completed: {()->() in
self.subscriptionTermsText.text = IAPHelper.subscriptionTerms
})
```
## Verify Purchase
Verify your Purchases with just one function call.
### Verify consumable, non-consuable and subscriptions
```
IAPHelper.verifyPurchase(with: IAPHelper.proSubscription, sharedSecret: IAPHelper.sharedSecret, type: .autoRenewable)
```
## Purchase
Purchase products.
```
IAPHelper.purchaseProduct(with: IAPHelper.proSubscription, sharedSecret: IAPHelper.sharedSecret, type: .autoRenewable)
```
## Restore Purchase
```
IAPHelper.restorePurchases()
```
## additionally
### loading indicator
If you want you can use my loading indicator I have used in the demo project.
Just use the IAPHelper.swift from the demo.
If you want to do it yourself:
Start the animation:
```
Spinner.start()
```
Stop the animation:
```
Spinner.stop()
```