feat(test-store): Add support for free trials in Test Store#6884
Conversation
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 3abbb84. Configure here.
| productId: self.identifier, | ||
| periodDuration: periodDuration | ||
| )) | ||
| return nil |
There was a problem hiding this comment.
Malformed trial period silently skips valid intro price
Medium Severity
In buildIntroductoryDiscount, when a trial phase exists with a malformed periodDuration, the guard on line 104 fails and returns nil immediately, without ever evaluating whether a valid introPrice phase exists. The warning log says "Skipping free trial" but the actual effect is skipping all introductory discounts. If the backend sends both a trial (with an unparseable period) and a valid intro price, the valid intro price is silently lost and the product appears to have no introductory offer at all.
Reviewed by Cursor Bugbot for commit 3abbb84. Configure here.
ajpallares
left a comment
There was a problem hiding this comment.
Great job! I think this looks great!


Description
This PR adds support for free trials in the Test Store, so they can be correctly fetched by developers using the iOS SDK. Important distinction regarding actual iOS products is that eligibility is calculated in the backend. So that means customers are always eligible if the discount is present in the product.
Note
Medium Risk
Changes Test Store intro eligibility semantics (eligible when a discount exists vs. always ineligible), which affects dev/preview flows but not production App Store eligibility paths.
Overview
Adds free trials and introductory prices to Test Store (Simulated Store) products by mapping web billing
trial/introPricephases intointroductoryDiscounton convertedStoreProducts, with free trial preferred when both are present and warnings whenperiod_durationis not valid ISO-8601.Intro/trial eligibility for Simulated Store API keys no longer marks every product ineligible: products with an introductory discount are eligible, others get no intro offer (unknown if the product isn’t loaded), without StoreKit or backend intro checks.
The test purchase alert now surfaces introductory offers (including free trial wording) alongside promotional discounts. New unit and StoreKit tests cover conversion, malformed periods, and eligibility behavior.
Reviewed by Cursor Bugbot for commit 3abbb84. Bugbot is set up for automated code reviews on this repo. Configure here.