[Billing Plans]: Include InstallmentsInfo in products in offering's packages#6784
Conversation
…ntroduce billingPlanIdentifier
|
|
||
| public override func isEqual(_ object: Any?) -> Bool { | ||
| return self.productIdentifier == (object as? StoreProductType)?.productIdentifier | ||
| guard let other = object as? StoreProductType else { return false } |
There was a problem hiding this comment.
Another alternative here would be to perform == on the internal StoreProduct.compoundProductIdentifier, but somehow this felt more "complete" to me. Let me know if y'all disagree!
There was a problem hiding this comment.
I think comparing compoundProductIdentifier should be equivalent to comparing installmentsInfo, but a bit clearer?
There was a problem hiding this comment.
Makes sense. I've renamed compoundProductIdentifier to id to match what we're doing on Android and changed this equals to just compare on id here: c4773bb
…/github.com/RevenueCat/purchases-ios into include-billing-plans-in-offerings-response
…/github.com/RevenueCat/purchases-ios into include-billing-plans-in-offerings-response
…/github.com/RevenueCat/purchases-ios into include-billing-plans-in-offerings-response
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7fc6244. Configure here.
| productPlanIdentifier: data.platformProductPlanIdentifier | ||
| )?.compoundProductIdentifier ?? data.platformProductIdentifier | ||
|
|
||
| guard let product = productsByID[compoundProductIdentifier] else { |
There was a problem hiding this comment.
Packages with billing plans silently dropped on older iOS
High Severity
On iOS < 26.4 (where billing plans aren't supported), packages with a platformProductPlanIdentifier will silently fail to be created. The productsByID dictionary is keyed by product.id which returns the base identifier (e.g., "com.app.sub") since populateSK2CompoundProductsIfSupported doesn't modify products on older OS. However, createPackage computes a compound lookup key (e.g., "com.app.sub:monthly") that won't match any dictionary entry. Before this PR, both sides used the base platformProductIdentifier, so they always matched.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 7fc6244. Configure here.
There was a problem hiding this comment.
This is okay - if the billing plan product isn't available, we shouldn't return a package for it
|
Got a verbal approval from @MarkVillacampa in Slack, will go ahead and merge into |


Description
This PR updates the SDK's
Offeringfetching logic so that it now includes packages with compound billing identifiers, and populates theInstallmentsInfoobject on the products in the packages. No new work was required in how the products themselves are fetched, we just needed to update how the SDK decides which products to use when hydrating the products for a given offering.Note
Medium Risk
Changes how offerings map backend packages to fetched products by switching to compound product identifiers (
productId:planId) and updatingStoreProductequality/hash semantics, which could affect product caching/lookups and missing-product handling. Behavior is covered by new/expanded unit tests but touches core purchasing/offering hydration paths.Overview
Offerings fetching/hydration now treats package product IDs as compound identifiers when a backend
platformProductPlanIdentifieris present, so the SDK requests and matches products usingproductIdentifier:planIdentifier(falling back to the base ID when absent).This introduces a unified
StoreProductType.id(SK1 = base ID, SK2 = compound ID) and updatesStoreProductequality/hash plusOfferingsManagerproduct dictionaries to useid, enabling billing-plan-specific packages to resolve to the correct product (includingInstallmentsInfo).Adds
InstallmentsInfoisEqual/hashimplementations and expands test coverage with newTestStoreProductTestsand additionalStoreProductTestsassertions aroundidbehavior.Reviewed by Cursor Bugbot for commit 7fc6244. Bugbot is set up for automated code reviews on this repo. Configure here.