EasyPurchase is a Swift package that simplifies the implementation of purchase logic and analytics for your iOS applications. It provides a set of public properties and functions to manage subscriptions, lifetime offers, the purchase process, and also collects and sends analytics data about user purchases. With EasyPurchase, you can seamlessly integrate in-app purchase functionality and gain valuable insights into user behavior.
isSubscribed
(Bool): A published property that indicates whether the user is currently subscribed.isLifetimeSubscription
(Bool): A published property that indicates whether the user has a lifetime subscription.offers
([Offer]): A published array of available offers.defaultOffer
(Offer): A property that indicates default offer(first selected offer from offers).
configure(appstoreId: String, secretKey: String, lifetimeProductId: String?, defaultOfferId: String, offerIds: [String], allProductIds: [String])
: Configure EasyPurchase with the necessary parameters, including the App Store ID, secret key, product identifiers, and other settings.restorePurchase(completion: @escaping (_ success: Bool, _ message: String) -> Void)
: Restore a previous purchase, if any, and call the provided completion handler with the results.purchase(_ offer: Offer, completion: @escaping (_ success: Bool, _ message: String) -> Void)
: Initiate a purchase for a specific offer and handle the result through the completion handler.purchase(_ productId: String, completion: @escaping (_ success: Bool, _ message: String) -> Void)
: Initiate a purchase for a specific product by its identifier and handle the result through the completion handler.
- Add EasyPurchase as a Swift package dependency in your Xcode project.
- Import the EasyPurchase framework into your code.
- Configure EasyPurchase with the necessary parameters using the
configure
function, including your App Store ID, secret key, and other relevant settings. - Use the provided properties and functions to manage purchase logic in your app.
- IMPORTANT! Add "Privacy - Tracking Usage Description" to your info.plist file value example(no brackets): "This identifier will be used to deliver personalized ads to you.".
import EasyPurchase
// Configure EasyPurchase
EasyPurchase.shared.configure(
appstoreId: "yourAppStoreID",
secretKey: "yourSecretKey",
lifetimeProductId: "yourLifetimeProductId",
defaultOfferId: "product Id that will be selected by defaults",
offerIds: [Array of product IDs you want to show in an offer to the user],
allProductIds: [Array of all product IDs that give a subscription to the user]
)
If you have any questions, issues, or suggestions regarding EasyPurchase, please create an issue on GitHub or contact us at [email protected].