purchases-ios

In-app purchases and subscriptions made easy. Support for iOS, watchOS, tvOS, macOS, and visionOS.

MIT License

Stars
2.1K
Committers
65

Bot releases are hidden (Show)

purchases-ios - 4.6.1

Published by revenuecat-ops over 2 years ago

This release is compatible with Xcode 14 beta 1

Bug fixes

  • EntitlementInfo.isActive returns true if requestDate == expirationDate (#1684) via beylmk (@beylmk)
  • Fixed usages of seealso (#1689) via NachoSoto (@NachoSoto)
  • Fixed ROT13.string thread-safety (#1686) via NachoSoto (@NachoSoto)
  • PurchasesOrchestrator: replaced calls to syncPurchases with posting receipt for an individual product during SK2 purchases (#1666) via NachoSoto (@NachoSoto)
purchases-ios - 4.6.0

Published by revenuecat-ops over 2 years ago

This release is compatible with Xcode 14 beta 1

New Features

  • EntitlementInfos: added activeInAnyEnvironment and activeInCurrentEnvironment (#1647) via NachoSoto (@NachoSoto)

In addition to EntitlementInfos.active, two new methods are added to allow detecting entitlements from sandbox and production environments:

customerInfo.entitlements.activeInCurrentEnvironment
customerInfo.entitlements.activeInAnyEnvironment

Bug fixes

  • MacDevice: changed usage of kIOMasterPortDefault to fix Catalyst compilation on Xcode 14 (#1676) via NachoSoto (@NachoSoto)
  • Result.init(value:error:): avoid creating error if value is provided (#1672) via NachoSoto (@NachoSoto)
purchases-ios - 4.5.2

Published by revenuecat-ops over 2 years ago

This version supports Xcode 14 beta 1

  • PurchasesOrchestrator.handleDeferredTransaction: check NSError.domain too (#1665) via NachoSoto (@NachoSoto)
  • PurchasesOrchestrator: replaced manual Lock with Atomic (#1664) via NachoSoto (@NachoSoto)
  • CodableStrings.decoding_error: added underlying error information (#1668) via NachoSoto (@NachoSoto)
  • Fixed Xcode 14 compilation: avoid @available properties (#1661) via NachoSoto (@NachoSoto)
purchases-ios - 4.5.1

Published by revenuecat-ops over 2 years ago

Fixes

Changes from 4.5.0

New Features

  • Purchases.customerInfo(): added overload with a new CacheFetchPolicy (#1608) via NachoSoto (@NachoSoto)
  • Storefront: added sk1CurrentStorefront for Objective-C (#1614) via NachoSoto (@NachoSoto)

Bug Fixes

  • Fix for not being able to read receipts on watchOS (#1625) via Patrick Busch (@patrickbusch)

Other Changes

  • Added tests for PurchasesOrchestrator invoking listenForTransactions only if SK2 is enabled (#1618) via NachoSoto (@NachoSoto)
  • PurchasesOrchestrator: removed lazy hack for properties with @available (#1596) via NachoSoto (@NachoSoto)
  • PurchasesOrchestrator.purchase(sk2Product:promotionalOffer:): simplified implementation with new operator (#1602) via NachoSoto (@NachoSoto)
purchases-ios - 4.4.1

Published by revenuecat-ops over 2 years ago

Fixes

Changes from 4.4.0

Configuration updates:

  • You can now use a Configuration object to configure the SDK with a cleaner syntax.
    Example of how to configure using Configuration:
 Purchases.configure(
     with: Configuration.Builder(withAPIKey: Constants.apiKey)
              .with(usesStoreKit2IfAvailable: true)
              .with(observerMode: false)
              .with(appUserID: "<app_user_id>")
              .build()
     )

⚠️ The configure(withAPIKey:appUserID:) method and its overloads have been deprecated in favor of using configure(with:) and passing in a Configuration.

New Features

  • Added new API key validation (#1581) via NachoSoto (@NachoSoto)
  • Sending X-Is-Sandbox header in API requests (#1582) via NachoSoto (@NachoSoto)
  • Added AmazonStore to Store enum (#1586) via Will Taylor (@fire-at-will)
  • Added Configuration object and API to configure Purchases (#1556) via Joshua Liebowitz (@taquitos)
  • Exposed shouldShowPriceConsent on PurchasesDelegate (#1520) via Joshua Liebowitz (@taquitos)

Fixes

  • ManageSubscriptionsHelper: fixed discrepancy between SystemInfo.isAppleSubscription(managementURL:) and SystemInfo.appleSubscriptionsURL (#1607) via NachoSoto (@NachoSoto)
  • PurchasesOrchestrator: don't listen for StoreKit 2 transactions if it's disabled (#1593) via NachoSoto (@NachoSoto)
  • Added tests and fix to ensure RawDataContainer includes all data (#1565) via NachoSoto (@NachoSoto)
  • Added obsoletion for DeferredPromotionalPurchaseBlock (#1600) via NachoSoto (@NachoSoto)
  • StoreKit 2 purchases: don't throw when purchase is cancelled (#1603) via NachoSoto (@NachoSoto)
  • Ensure SubscriptionPeriods are represented as 1week instead of 7days (#1591) via Will Taylor (@fire-at-will)
  • PurchaseStrings: fixed transaction message formatting (#1571) via NachoSoto (@NachoSoto)
  • willRenew update comment for lifetime will be false (#1579) via Josh Holtz (@joshdholtz)
  • SK1StoreProductDiscount: handle SKProductDiscount.priceLocale being nil and created StoreKitWorkarounds (#1545) via NachoSoto (@NachoSoto)
  • Fixed ErrorUtils.logDecodingError (#1539) via NachoSoto (@NachoSoto)

Other changes

  • GetIntroEligibilityOperation: replaced response parsing with Decodable (#1576) via NachoSoto (@NachoSoto)
  • PostOfferForSigningOperation: changed response parsing to using Decodable (#1573) via NachoSoto (@NachoSoto)
  • Converted CustomerInfo and related types to use Codable (#1496) via NachoSoto (@NachoSoto)
  • MagicWeatherSwiftUI: fixed usage of PurchaseDelegate (#1601) via NachoSoto (@NachoSoto)
  • Added tests for PeriodType/PurchaseOwnershipType/Store (#1558) via NachoSoto (@NachoSoto)
  • Fix description of StoreTransaction (#1584) via aboedo (@aboedo)
  • Prepare the codebase to listen to the Storefront changes (1/4) (#1557) via Juanpe CatalΓ‘n (@Juanpe)
  • Purchases.canMakePayments: moved implementation to StoreKitWrapper (#1580) via NachoSoto (@NachoSoto)
  • BackendGetIntroEligibilityTests: fixed test that was passing before anything ran (#1575) via NachoSoto (@NachoSoto)
  • PeriodType/PurchaseOwnershipType/Store: conform to Encodable (#1551) via NachoSoto (@NachoSoto)
  • Improved EntitlementInfosTests (#1547) via NachoSoto (@NachoSoto)
  • ProductRequestData: added Storefront for receipt posting (#1505) via NachoSoto (@NachoSoto)
  • Added RawDataContainer conformances to APITesters (#1550) via NachoSoto (@NachoSoto)
  • Simplified EntitlementInfo.isEqual (#1548) via NachoSoto (@NachoSoto)
  • CustomerInfo: moved deprecated property to Deprecations (#1549) via NachoSoto (@NachoSoto)
  • PackageType: simplified typesByDescription and implemented CustomDebugStringConvertible (#1531) via NachoSoto (@NachoSoto)
purchases-ios - 3.14.2

Published by revenuecat-ops over 2 years ago

purchases-ios - 4.3.0

Published by revenuecat-ops over 2 years ago

API updates:

  • Introduced new Storefront type to abstract SK1's SKStorefront and SK2's StoreKit.Storefront.
  • Exposed Storefront.currentStorefront.
  • Added new ErrorCode.offlineConnectionError to differenciate offline errors versus the more generic .networkError.
  • Added Purchases.setFirebaseAppInstanceID to allow associating RevenueCat users with Firebase.
  • Added Purchases.setPushTokenString as an overload to Purchases.setPushToken.
  • Renamed PurchasesDelegate.purchases(_:shouldPurchasePromoProduct:defermentBlock:) to PurchasesDelegate.purchases(_ purchases: Purchases, readyForPromotedProduct product: StoreProduct, purchase:) to clarify its usage (see #1460).

Other:

  • Many improvements to error reporting and logging to help debugging.
  • Optimized StoreKit 2 purchasing by eliminating a duplicate API request.
  • A lot of under-the-hood improvements, mainly focusing on networking. If you see any issues we'd appreciate bug reports!
purchases-ios - 4.2.1

Published by revenuecat-ops over 2 years ago

Version 4.2.1 changes:

  • Fixed a potential race condition when syncing user attributes #1479

Version 4.2.0 changes:

API updates:

  • Added new method setMixpanelDistinctID as a convenience method for setting the required attribute for the Mixpanel integration #1397

  • getPromotionalOffer has been deprecated in favor of promotionalOffer #1405

  • getEligiblePromotionalOffers has been deprecated in favor of eligiblePromotionalOffers #1405

  • StoreProductDiscount now includes the numberOfPeriods property #1428

Other:

  • Added workaround for StoreKit 1 incorrectly reporting purchase cancellations #1450

  • MagicWeatherSwiftUI now includes an example for using purchases(:shouldPurchasePromoProduct:defermentBlock:) #1459

  • Various documentation improvements

  • Additional under-the-hood improvements, continuing to focus on network requests and tests.

purchases-ios - 4.2.0

Published by revenuecat-ops over 2 years ago

API updates:

  • Added new method setMixpanelDistinctID as a convenience method for setting the required attribute for the Mixpanel integration #1397

  • getPromotionalOffer has been deprecated in favor of promotionalOffer #1405

  • getEligiblePromotionalOffers has been deprecated in favor of eligiblePromotionalOffers #1405

  • StoreProductDiscount now includes the numberOfPeriods property #1428

Other:

  • Added workaround for StoreKit 1 incorrectly reporting purchase cancellations #1450

  • MagicWeatherSwiftUI now includes an example for using purchases(:shouldPurchasePromoProduct:defermentBlock:) #1459

  • Various documentation improvements

  • Additional under-the-hood improvements, continuing to focus on network requests and tests.

purchases-ios - 4.1.0

Published by revenuecat-ops over 2 years ago

API updates:

  • Added new method checkTrialOrIntroDiscountEligibility(product:), which allows you to check for intro or discount eligibility for a single StoreProduct.
    https://github.com/RevenueCat/purchases-ios/pull/1354

  • Added explicit parameter name for checkTrialOrIntroDiscountEligibility(productIdentifiers:).
    The existing method without the parameter name still work, but is now deprecated. Xcode will offer an auto fix-it for it.
    https://github.com/RevenueCat/purchases-ios/pull/1362

  • Made StoreProduct initializers public so they can be used for testing.

Other:

purchases-ios - 4.0.0

Published by revenuecat-ops over 2 years ago

RevenueCat iOS SDK v4 is here!!

Dancing cats

Full Changelog

Migration Guide

  • See our RevenueCat V4 API update doc for API updates.
    Note: This release is based off of 4.0.0-rc.4. Developers migrating from that version shouldn't see any changes.

API changes:

There have been a lot of changes since v3!

Here are the highlights:

Async / Await alternative APIs

New async / await alternatives for all APIs that have completion blocks, as well as an AsyncStream for CustomerInfo.

New types and cleaned up naming

New types that wrap StoreKit's native types, and we cleaned up the naming of other types and methods for a more consistent experience.

New APIs for Customer Support

You can now use showManageSubscriptions() and beginRefundRequest() to help your users manage their subscriptions right from the app.

Rewritten in Swift

We rewrote the SDK in 100% Swift. This made the code more uniform and easy to maintain, and helps us better support StoreKit 2.

StoreKit 2 Support [Beta]

[Experimental] Introduced support for using StoreKit 2 under the hood for compatible devices. This is currently in beta phase, and disabled by default.
When enabled, StoreKit 2 APIs will be used under the hood for purchases in compatible devices. You can enable this by configuring the SDK passing useStoreKit2IfAvailable: true.
On devices that don't support StoreKit 2, StoreKit 1 will be used automatically instead.

Full API changes list

Documentation:

We built a new Documentation site with Docc with cleaner and more detailed docs.
The new documentation can be found here.

purchases-ios - 4.0.0-rc.4

Published by revenuecat-ops over 2 years ago

  • Fourth RC for RevenueCat framework v4 πŸŽ‰
    100% Swift framework + ObjC support.

Full Changelog

RC 4 introduces the following updates:

API changes:

Breaking changes:

  • Replaced checkPromotionalDiscountEligibility with getPromotionalOffer, which returns a PromotionalOffer.
  • Renamed Purchases/purchase(package:discount:) and its variants to Purchases/purchase(package:promotionalOffer:). They now take a PromotionalOffer instead of a StoreProductDiscount.
  • [Objective-C only]: Updated type of StoreProduct.price and StoreProductDiscount.price from NSDecimal to the much more useful NSDecimalNumber.

Additions:

  • Added StoreProduct.ProductType, and StoreProduct.ProductCategory, which provide extra information about whether a product is a consumable, non-consumable, auto-renewable or non-auto-renewable subscription.
  • Added currencyCode to StoreProduct and StoreProductDiscount.
  • Added localizedPriceString to StoreProductDiscount.

Documentation:

Other changes:

  • There are lots of under the hood improvements. If you see any issues we'd appreciate bug reports!

Changes from previous RC

These changes add to all of the changes from beta RC 2, listed here.

purchases-ios - 4.0.0-rc.3

Published by revenuecat-ops over 2 years ago

  • Third RC for RevenueCat framework v4 πŸŽ‰
    100% Swift framework + ObjC support.

Full Changelog

RC 3 introduces the following updates:

API changes:

  • Added setCleverTapID, for integration with CleverTap.
  • Added .noIntroOfferExists as an IntroEligibilityStatus, for more granularity when checking for intro pricing eligibility.
  • Added StoreProductDiscount.type, which allows you to easily tell whether a discount represents a Promo Offer or an Intro Pricing.

Documentation:

Migration fixes

  • Fixed a few instances where Xcode's automatic migration tools wouldn't automatically suggest a fix-it for updated code.

Other changes:

  • There are lots of under the hood improvements. If you see any issues we'd appreciate bug reports!

Changes from previous RC

These changes add to all of the changes from beta RC 2, listed here.

purchases-ios - 3.14.1

Published by aboedo over 2 years ago

purchases-ios - 4.0.0-rc.2

Published by revenuecat-ops over 2 years ago

  • Second RC for RevenueCat framework v4 πŸŽ‰
    100% Swift framework + ObjC support.

Full Changelog

RC 2 introduces the following updates:

API changes:

  • Removed SubscriptionPeriod.Unit.unknown. Subscriptions with empty SubscriptionPeriod values will have nil subscriptionPeriod instead.
  • Removed StoreProductDiscount.none, since it wasn't needed.
  • Added useStoreKit2IfAvailable (Experimental) configuration option. This is disabled by default.
    If enabled, the SDK will use StoreKit 2 APIs for purchases under the hood.
    This is currently in an experimental phase, and we don't recommend using it in production in this build.

Documentation:

Migration fixes

  • Fixed a few instances where Xcode's automatic migration tools wouldn't correctly update the code.

Other changes:

  • There are lots of under the hood improvements. If you see any issues we'd appreciate bug reports!

Changes from previous RC

These changes add to all of the changes from beta RC 1, listed here.

purchases-ios - 4.0.0-rc.1

Published by revenuecat-ops over 2 years ago

  • First RC for RevenueCat framework v4 πŸŽ‰
    100% Swift framework + ObjC support.

Full Changelog

RC 1 introduces the following updates:

API changes:

  • Purchases.paymentDiscount(forProductDiscount:product:completion:) and Purchases.paymentDiscount(forProductDiscount:product:) have been removed. Now, instead of obtaining the SKPaymentDiscount from a SKProductDiscount to then call purchase(package:discount:), you check eligibility for the promo offer by calling checkPromotionalDiscountEligibility(forProductDiscount:product:), then get the StoreProductDiscount directly from the StoreProduct and pass that into purchase(package:discount:).

  • StoreProduct and StoreProductDiscount, replace SKProduct and SKProductDiscount in the following methods:

    • Purchases.getProducts(_:completion:)
    • Purchases.products(_:)
    • Purchases.purchase(product:completion:)
    • Purchases.purchase(product:)
    • Purchases.purchase(product:discount:completion:)
    • Purchases.purchase(product:discount:)
    • Purchases.purchase(package:discount:completion:)
    • Purchases.purchase(package:discount:)
    • PurchasesDelegate.purchases(shouldPurchasePromoProduct:defermentBlock:)
  • StoreProduct.introductoryPrice has been renamed to StoreProduct.introductoryDiscount

  • StoreTransaction now includes quantity

  • Renamed Purchases.restoreTransactions to Purchases.restorePurchases

  • Lowered StoreProduct.introductoryDiscount availability to iOS 11.2 and equivalent OS versions

  • Added several @available annotations for automatic migration from StoreKit types

In addition to all of the changes from beta 10, listed here.

Other changes:

  • There are lots of under the hood improvements. If you see any issues we'd appreciate bug reports!
purchases-ios - 3.14.0

Published by vegaro over 2 years ago

purchases-ios - 3.13.2

Published by revenuecat-ops almost 3 years ago

purchases-ios - 4.0.0-beta.10

Published by revenuecat-ops almost 3 years ago

  • Tenth beta for RevenueCat framework πŸŽ‰
    100% Swift framework + ObjC support.

Full Changelog

Beta 10 introduces the following updates:

Breaking changes:

  • A new type, StoreTransaction, replaces SKPaymentTransaction in the return types of the following methods:
    • Purchases.purchase(product:completion:)
    • Purchases.purchase(package:completion:)
    • Purchases.purchase(package:discount:completion:)
    • Purchases.purchase(package:discount:completion:)
    • PurchasesDelegate.purchases(shouldPurchasePromoProduct:defermentBlock:)
    • CustomerInfo.nonSubscriptionTransactions
  • StoreProduct.PromotionalOffer has been renamed to StoreProduct.StoreProductDiscount.

In addition to all of the changes from beta 9, listed here.

Other changes:

  • There are lots of under the hood improvements. If you see any issues we'd appreciate bug reports!
purchases-ios - 4.0.0-beta.9

Published by revenuecat-ops almost 3 years ago

  • Ninth beta for RevenueCat framework πŸŽ‰
    100% Swift framework + ObjC support.

Full Changelog

Breaking changes:

  • identify, previously deprecated, has been removed in favor of logIn.
  • reset, previously deprecated, has been removed in favor of logOut.
  • Package.product has been replaced with Package.storeProduct. This is an abstraction of StoreKit 1's SKProduct and StoreKit 2's StoreKit.Product, but it also adds useful features like pricePerMonth and priceFormatter. The underlying objects from StoreKit are available through StoreProduct.sk1Product and StoreProduct.sk2Product.

Xcode version requirements and updated deployment targets

purchases-ios v4 requires using Xcode 13.2 or newer.
It also updates the minimum deployment targets for iOS, macOS and tvOS.

Minimum deployment targets
v3 v4
iOS 9.0 11.0
tvOS 9.0 11.0
macOS 10.12 10.13
watchOS 6.2 6.2 (unchanged)

StoreKit 2 support:

  • This beta introduces new methods that add functionality using StoreKit 2:
    • showManageSuscriptions(completion:)
    • beginRefundRequest(forProduct:)
    • beginRefundRequest(forEntitlement:).
    • beginRefundRequestForActiveEntitlement()
  • checkTrialOrIntroductoryPriceEligibility(productIdentifiers:completion:) now uses StoreKit 2 if it's available, to make calculation more accurate and fast.
  • A new flag has been introduced to setup, useStoreKit2IfAvailable (defaults to false), to use StoreKit 2 APIs for purchases instead of StoreKit 1.

Async / Await alternative APIs

  • In purchases-ios v3, Async / Await alternative APIs were made available through Xcode's auto-generation for Objective-C projects. This beta re-adds the Async / Await alternative APIs for v4.

New APIs:

  • showManageSuscriptions(completion:): Use this method to show the subscription management for the current user. Depending on where they made the purchase and their OS version, this might take them to the managementURL, or open the iOS Subscription Management page.
  • beginRefundRequestForCurrentEntitlement: Use this method to begin a refund request for the purchase that granted the current entitlement.
  • beginRefundRequest(forProduct:): Use this method to begin a refund request for a purchase, specifying the product identifier.
  • beginRefundRequest(forEntitlement:): Use this method to begin a refund request for a purchase, specifying the entitlement identifier.
  • Adds an optional useStoreKit2IfAvailable parameter to setup (defaults to false). If enabled, purchases will be done by using StoreKit 2 APIs instead of StoreKit 1. This is currently experimental, and not all features are supported with StoreKit 2 APIs.
  • Use verboseLogHandler or verboseLogs to enable more details in logs, including file names, line numbers and method names.

Known issues:

  • Promotional offers and deferred purchases are not currently supported with StoreKit 2. If your app uses either of those, you should omit useStoreKit2IfAvailable in setup or set it to false.

Other changes:

  • There are lots of under the hood improvements. If you see any issues we'd appreciate bug reports!