Skip to content

[Billing Plans]: Handle winback offer eligibility properly for products with billing plans#6845

Merged
fire-at-will merged 17 commits into
billing-plans-devfrom
winback-offer-eligibility
May 28, 2026
Merged

[Billing Plans]: Handle winback offer eligibility properly for products with billing plans#6845
fire-at-will merged 17 commits into
billing-plans-devfrom
winback-offer-eligibility

Conversation

@fire-at-will

@fire-at-will fire-at-will commented May 26, 2026

Copy link
Copy Markdown
Contributor

Description

Adds support for properly checking win-back offer eligibility for products with billing plans.

This is currently slated to merge into the intro-offer-eligibility branch, but we'll switch it to merge into billing-plans-dev when intro-offer-eligibility is merged into the dev branch.

Testing

Manually tested with the purchase tester app


Note

Medium Risk
Changes which win-back offers are returned for billing-plan subscriptions (purchase/promo path), though behavior is guarded by OS/compiler availability and covered by new unit tests.

Overview
Refactors win-back offer eligibility so billing-plan products only surface offers tied to the product’s plan, and adds protocol-based adapters so the calculator logic can be unit tested without StoreKit.

On iOS 26.4+ (with a new enough compiler), eligible offer IDs from renewal info are intersected with win-back offers available on the product’s billingPlanType (via pricingTerms), and the offer catalog now merges subscription-level win-backs with win-backs that exist only on specific pricing terms. StoreKit mapping lives in new WinBackEligibilityAdapters.swift; WinBackOfferEligibilityCalculator operates on internal protocols instead of calling StoreKit directly.

Adds WinBackOfferEligibilityCalculatorTests with mocks covering empty/error paths, offer ordering, and billing-plan filtering.

Reviewed by Cursor Bugbot for commit 3f0654f. Bugbot is set up for automated code reviews on this repo. Configure here.

@fire-at-will fire-at-will requested a review from a team as a code owner May 26, 2026 19:31
@fire-at-will fire-at-will added the pr:feat A new feature label May 26, 2026
@emerge-tools

emerge-tools Bot commented May 26, 2026

Copy link
Copy Markdown

⚠️ 3 new unused protocols, 4 builds increased size

Name Version Download Change Install Change Approval
RevenueCat
com.revenuecat.PaywallsTester
1.0 (1) 18.1 MB ⬆️ 54.8 kB (0.3%) 64.9 MB ⬆️ 208.8 kB (0.32%) N/A
BinarySizeTest
com.revenuecat.binary-size-test.local-source
1.0 (1) 4.1 MB ⬆️ 22.3 kB (0.54%) 12.4 MB ⬆️ 49.5 kB (0.41%) ⏳ Needs approval
BinarySizeTest
com.revenuecat.binary-size-test.cocoapods
1.0 (1) 6.2 MB ⬆️ 29.2 kB (0.47%) 27.3 MB ⬆️ 103.0 kB (0.38%) ⏳ Needs approval
BinarySizeTest
com.revenuecat.binary-size-test.spm
1.0 (1) 4.2 MB ⬆️ 19.9 kB (0.47%) 10.8 MB ⬆️ 44.7 kB (0.42%) ⏳ Needs approval

RevenueCat 1.0 (1)
com.revenuecat.PaywallsTester

⚠️ Found new unused protocol: WinBackEligibilityPricingTermsType
⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬆️ 208.8 kB (0.32%)
Total download size change: ⬆️ 54.8 kB (0.3%)

Largest size changes

Item Install Size Change
DYLD.String Table ⬆️ 78.1 kB
📝 RCInstallmentsInfo.Objc Metadata ⬆️ 8.8 kB
Code Signature ⬆️ 5.7 kB
DYLD.Exports ⬆️ 4.9 kB
RevenueCat.ProductsManager.ProductsManager ⬆️ 3.7 kB
View Treemap

Image of diff

BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.local-source

⚠️ Found new unused protocol: WinBackEligibilityPricingTermsType
⚖️ Compare build
📦 Install build
⏱️ Analyze build performance

Total install size change: ⬆️ 49.5 kB (0.41%)
Total download size change: ⬆️ 22.3 kB (0.54%)

Largest size changes

Item Install Size Change
DYLD.String Table ⬆️ 3.3 kB
📝 RevenueCat.WinBackOfferEligibilityCalculator.winbackOffersByID(fo... ⬆️ 2.2 kB
📝 RCInstallmentsInfo.Objc Metadata ⬆️ 2.1 kB
DYLD.Exports ⬆️ 1.8 kB
Code Signature ⬆️ 1.5 kB
View Treemap

Image of diff

BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.cocoapods

⚠️ Found new unused protocol: WinBackEligibilityPricingTermsType
⚖️ Compare build
📦 Install build
⏱️ Analyze build performance

Total install size change: ⬆️ 103.0 kB (0.38%)
Total download size change: ⬆️ 29.2 kB (0.47%)

Largest size changes

Item Install Size Change
DYLD.String Table ⬆️ 37.5 kB
Code Signature ⬆️ 2.4 kB
📝 RevenueCat.WinBackOfferEligibilityCalculator.winbackOffersByID(fo... ⬆️ 2.3 kB
📝 RCInstallmentsInfo.Objc Metadata ⬆️ 2.1 kB
DYLD.Exports ⬆️ 1.8 kB
View Treemap

Image of diff

BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.spm

⚖️ Compare build
📦 Install build
⏱️ Analyze build performance

Total install size change: ⬆️ 44.7 kB (0.42%)
Total download size change: ⬆️ 19.9 kB (0.47%)

Largest size changes

Item Install Size Change
📝 RevenueCat.WinBackOfferEligibilityCalculator.winbackOffersByID(fo... ⬆️ 2.2 kB
📝 RCInstallmentsInfo.Objc Metadata ⬆️ 2.1 kB
DYLD.Exports ⬆️ 1.8 kB
Swift.Sequence.compactMap ⬇️ -1.4 kB
Code Signature ⬆️ 1.2 kB
View Treemap

Image of diff


🛸 Powered by Emerge Tools

Comment trigger: Size diff threshold of 100.00kB exceeded

Comment thread Sources/Purchasing/StoreKitAbstractions/BillingPlanType.swift Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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 e013643. Configure here.

@JZDesign JZDesign left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests seem needed here…

Base automatically changed from intro-offer-eligibility to billing-plans-dev May 27, 2026 15:14
* make the calculator testable

* compilation fix + handle unknown ownershipType case

* more compilation fixes

* more compiler fixes

* compile fix

* more compilation fixes

* update comments

* add test
@fire-at-will

Copy link
Copy Markdown
Contributor Author

Got approval on #6866 from @JZDesign, which adds tests to the win-back eligibility calculation. Going to go ahead and merge this one into the dev branch once the tests pass

@fire-at-will fire-at-will merged commit 16d5733 into billing-plans-dev May 28, 2026
10 of 19 checks passed
@fire-at-will fire-at-will deleted the winback-offer-eligibility branch May 28, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants