Skip to content

[WEB-4279] Discount line items in native wallets#905

Merged
james-od merged 15 commits into
mainfrom
WEB-4279-Discounts_in_native_wallets_2
Jun 15, 2026
Merged

[WEB-4279] Discount line items in native wallets#905
james-od merged 15 commits into
mainfrom
WEB-4279-Discounts_in_native_wallets_2

Conversation

@james-od

@james-od james-od commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Motivation / Description

This PR adds lineItems to the Native Wallet UIs.
We intentionally do not add the trialBilling/regularBilling fields to the Apple Pay box, like we do for free trials, due to complexity in ensuring we show the exactly correct start/end dates for the discount applying. This can be added in a follow up.

It's worth noting that while this PR is large this is mostly tests+refactoring. The core concept is really just passing through the values and strings to the Express Checkout that we already determine equivalently in the pricing table in the base checkout.

I extracted a src/helpers/discount-breakdown-helper.ts util to share a common source for determining the line item values in the RC checkout line items and in the Wallet line items.

Note: On the changed stories - I think these are fine in that no localisation is better than bad localisation.

Note: If a reviewer has an iPhone I'd love to confirm that everything looks good with Apple Pay and taxes enabled in the line items. I wasn't able to get this tested locally.

Loom: https://www.loom.com/share/7f48c3beac9d4a659e5ab69b5d0c7299

Changes introduced

Linear ticket (if any)

Additional comments


Note

Medium Risk
Touches checkout wallet pricing and amount math; incorrect line-item totals can cause Stripe to drop items silently, though tests assert balancing.

Overview
Adds discount breakdown line items to Apple Pay / Google Pay (Stripe Express Checkout) so wallet UIs show product + discount rows that match the RC pricing table.

Introduces discount-breakdown-helper to compute amount, display name, suffix (e.g. 20% off for 3 months), and label from purchase-option discounts or applied promo codes. pricing-table and product-info now take a precomputed resolvedDiscount instead of duplicating suffix/amount logic.

StripeService builds balanced lineItems (subtotal + negative discount) when a discount exists; subscription express options still use Apple Pay recurring/trial billing without discount-specific recurring fields. buildStripeExpressCheckoutOptionsForNonSubscription is new, and express purchase / payment entry wire resolvedDiscount for both subscriptions and consumables. Wallet click resolve now passes lineItems alongside Apple Pay config.

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

@james-od james-od force-pushed the WEB-4279-Discounts_in_native_wallets_2 branch 3 times, most recently from 94864d1 to b98cf35 Compare June 4, 2026 15:20
@james-od james-od force-pushed the WEB-4279-Discounts_in_native_wallets_2 branch from b98cf35 to f7c1e25 Compare June 4, 2026 16:36
@james-od james-od force-pushed the WEB-4279-Discounts_in_native_wallets_2 branch from c95f724 to f0d1c08 Compare June 4, 2026 20:55
@james-od james-od force-pushed the WEB-4279-Discounts_in_native_wallets_2 branch from 4b28bc3 to 199971b Compare June 5, 2026 10:21
@james-od james-od force-pushed the WEB-4279-Discounts_in_native_wallets_2 branch from dfae563 to 2fc7e4e Compare June 5, 2026 10:39
@james-od james-od force-pushed the WEB-4279-Discounts_in_native_wallets_2 branch from 910863e to 1c6bf2f Compare June 5, 2026 12:30
@james-od james-od force-pushed the WEB-4279-Discounts_in_native_wallets_2 branch from da473ab to 1f3a50a Compare June 5, 2026 15:05
@james-od james-od marked this pull request as ready for review June 5, 2026 16:22
@james-od james-od changed the title [WEB-4279] Discounts in native wallets [WEB-4279] Discount line items in native wallets Jun 5, 2026
@vicfergar

Copy link
Copy Markdown
Contributor

LGTM, although I wasn’t able to test it on an iPhone.

@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 717afe2. Configure here.

Comment thread src/ui/express-purchase-button/stripe-helpers.ts
@james-od james-od merged commit 6494bb5 into main Jun 15, 2026
7 checks passed
@james-od james-od deleted the WEB-4279-Discounts_in_native_wallets_2 branch June 15, 2026 14:45
RCGitBot added a commit that referenced this pull request Jun 16, 2026
**This is an automatic release.**

## RevenueCat SDK
### ✨ New Features
* Add Slovenian support for paywalls (#932) via Monika Mateska
(@MonikaMateska)
* [WEB-4279] Discount line items in native wallets (#905) via James
O'Donnell (@james-od)

## RevenueCatUI SDK
### ✨ New Features
* WFL-217 | Add support for workflows endpoints (#913) via Rosie Watson
(@RosieWatson)

### 🔄 Other Changes
* [AUTOMATIC] Update generated error codes (#931) via RevenueCat Git Bot
(@RCGitBot)
* Danger: block manual edits to generated error codes (#930) via Álvaro
Brey (@AlvaroBrey)
* Add update-error-codes workflow (#926) via Álvaro Brey (@AlvaroBrey)
* test(e2e): add full Paddle E2E coverage to webbilling-demo (WST-564)
(#925) via Roger Solé (@rogersole)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Version and changelog-only changes with no runtime logic modified in
this PR.
> 
> **Overview**
> **Automatic release** that publishes **1.43.0** by aligning version
metadata everywhere it is duplicated: `.version`, `package.json`,
`src/helpers/constants.ts`, and the docs redirect in
`scripts/docs/index.html` (1.42.4 → 1.43.0).
> 
> `CHANGELOG.md` and `CHANGELOG.latest.md` are updated to document what
ships in this release (already merged elsewhere): **Slovenian paywall
locale**, **discount line items in native wallets**, **RevenueCatUI
workflows endpoints**, regenerated error codes plus CI/Danger
guardrails, and expanded Paddle E2E coverage in webbilling-demo.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
ef5e9f3. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants