Web: productChangeInfo on PurchaseParams.package is dropped before reaching purchases-js, so a plan change creates a second subscription

Open
#2,002 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
dart, javascript
Domain
api, mobile

Research direction

Read lib/web/purchases_flutter_web.dart _purchasePackage and purchases-common.ts purchasePackage / createNativePurchaseParams in purchases-hybrid-common to trace the parameter flow and agree on the web-specific type shape. Add coverage for forwarding productChangeInfo through both layers; done means a web purchase reaches purchases-js with the subscription ID and subscriber token, and the relevant tests pass.

Written by the indexing model from the issue text.

Description

Summary

On web, Purchases.purchase(PurchaseParams.package(pkg, productChangeInfo: …)) silently ignores productChangeInfo. The underlying @revenuecat/purchases-js SDK supports product changes (purchase({ rcPackage, productChangeInfo: { subscriptionId, subscriberToken } }), per https://www.revenuecat.com/docs/web/product-changes), but the parameter is dropped twice before it gets there:

  1. purchases_flutter web plugin — lib/web/purchases_flutter_web.dart, _purchasePackage forwards only packageIdentifier, presentedOfferingContext and customerEmail (10.19.0; unchanged in 11.0.0).
  2. purchases-hybrid-common JS mappings — purchases-js-hybrid-mappings/src/purchases-common.ts, purchasePackage(purchaseParams) accepts only packageIdentifier, presentedOfferingContext, optionIdentifier, customerEmail, selectedLocale, defaultLocale, and createNativePurchaseParams never sets productChangeInfo on the PurchaseParams it passes to purchases.purchase (current main, after the 20.3.0 release).

So a Flutter web app whose customer holds an active Web Billing subscription and buys a different package gets a second subscription instead of the configured upgrade/downgrade path, even with change paths configured in the dashboard.

Expected

The same productChangeInfo parameter that is already accepted on the Dart side reaches purchases-js, so a product change on web behaves like it does when calling purchases-js directly: upgrades apply immediately with proration, downgrades at the end of the cycle.

The existing Dart type StoreProductChangeInfo is Play-shaped (oldProductIdentifier, prorationMode), so web needs a shape with subscriptionId / productIdentifier + subscriberToken. Either a web variant of the type, or a dedicated web-only field on PurchaseParams, would work.

Steps to reproduce

  1. Flutter web app on purchases_flutter 10.19.0 (or 11.0.0), configured with a Web Billing (Stripe Billing) API key.
  2. Configure an upgrade path A → B in the RevenueCat dashboard Product Catalog.
  3. Customer holds an active subscription to A.
  4. Mint a subscriber token server-side (POST /v2/projects/{p}/apps/{a}/authenticate) and call Purchases.purchase(PurchaseParams.package(packageB, productChangeInfo: …)).
  5. Observe a new subscription to B is created alongside A; no product change occurs. The dropped parameter is visible in the two functions above.

Environment

  • purchases_flutter 10.19.0 (also checked 11.0.0 source)
  • purchases-hybrid-common JS mappings at current main (20.3.0, 2026-11-02)
  • Flutter web (CanvasKit), Chrome; Stripe Billing engine

Related

  • RevenueCat/purchases-js#182 and RevenueCat/purchases-js#938 track the SDK-level feature, which now exists. This issue is only about the hybrid layers not forwarding it.

Happy to open a PR for the Dart side if the hybrid-common side gets a productChangeInfo field.

Dominant language
Dart
Stars
722
Forks
220
Avg merge
16h 36m
Merged PRs (30d)
25

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RevenueCat/purchases-flutter

All issues in RevenueCat/purchases-flutter

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.