An ios package for in app purchase integration.
- Xcode -> File -> Swift Packages -> Add Package Dependencies
- put
https://github.com/nitanta/EasyIAP.git
and follow the prompts.
-
Set the product ids for fetching data
//Set the product ids before fetching it public func setProductIds(ids: [String])
-
Purchase a prudct
//Purchase the selected SKProduct public func purchase(product: SKProduct, completion: @escaping ((IAPState)->Void))
-
The IAP states during transaction
//Different states for the IAP purchase transaction case setProductIds case disabled case restored(SKPaymentTransaction?) case purchased(SKProduct?, SKPaymentTransaction) case productList([SKProduct]) case emptyProducts case receiptDownload(String)
-
Restore the IAP purchase
//Restore the IAP purchase public func restorePurchase(completion: @escaping ((IAPState)->Void))
-
Fetch available prouducts in the store
//Get the available products in the store public func fetchAvailableProducts(completion: @escaping ((IAPState)->Void))
-
Get the purchase receipt
//Get the purchase receipt public func getPurchaseReceipt(completion: @escaping ((IAPState)->Void))