Skip to content

feat(test-store): Add support for free trials in Test Store#6884

Merged
tonidero merged 5 commits into
mainfrom
rickvdl/simulated-store-free-trial
Jun 2, 2026
Merged

feat(test-store): Add support for free trials in Test Store#6884
tonidero merged 5 commits into
mainfrom
rickvdl/simulated-store-free-trial

Conversation

@tonidero

@tonidero tonidero commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

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 / introPrice phases into introductoryDiscount on converted StoreProducts, with free trial preferred when both are present and warnings when period_duration is 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.

@tonidero tonidero added the pr:feat A new feature label Jun 2, 2026
@tonidero tonidero marked this pull request as ready for review June 2, 2026 12:30
@tonidero tonidero requested a review from a team as a code owner June 2, 2026 12:30

@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 3abbb84. Configure here.

productId: self.identifier,
periodDuration: periodDuration
))
return nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3abbb84. Configure here.

@ajpallares ajpallares left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great job! I think this looks great!

@tonidero tonidero merged commit 0b8fc7d into main Jun 2, 2026
43 checks passed
@tonidero tonidero deleted the rickvdl/simulated-store-free-trial branch June 2, 2026 15:20
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.

3 participants