Skip to content

[WST-851] Pass discount codes to Stripe Billing checkout#976

Draft
nicfix wants to merge 4 commits into
mainfrom
WST-851
Draft

[WST-851] Pass discount codes to Stripe Billing checkout#976
nicfix wants to merge 4 commits into
mainfrom
WST-851

Conversation

@nicfix

@nicfix nicfix commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Why

The first implementation sent discountCode directly to /checkout/start for Stripe Billing. RevenueCat Web Billing instead represents the selected offer as a purchase option and sends that option back when checkout starts.

Stripe Billing should follow the same data flow so the selected promotion code is part of the product purchase option rather than a separate checkout-start parameter.

What changed

  • When a Stripe purchase receives discountCode, fetch the selected product from /products with that code.
  • Use the default purchase option returned by Khepri. A valid Stripe Promotion Code is represented by an opaque ID such as stripe_promo;code=SUMMER20; the option keeps the product's normal price in this first implementation.
  • Send non-base options to /checkout/start as purchase_option_id.
  • Remove the separate Stripe discount_code field from the /checkout/start request and from the Stripe Checkout UI plumbing.
  • Keep the Web Billing example's optional discount-code input so this flow can be smoke-tested.

Compatibility and rollout

  • Calls without discountCode continue using the package's selected or default purchase option without another product lookup.
  • If Khepri returns the base option because the code is disabled, inactive, or unknown, Stripe Checkout continues without a pre-applied discount and follows the app's allow_promotion_codes setting.
  • The existing RevenueCat Web Billing discount-code input and checkout-pricing update flow are unchanged.
  • discountCode remains an experimental public SDK field in this PR. Stabilizing the related discount-code APIs will be handled separately.
  • Backend support is provided by khepri#22676.

@nicfix nicfix changed the title WST-581: Added support for discountCodes in Stripe Billing [WST-851] Pass discount codes to Stripe Billing checkout Jul 20, 2026
@nicfix nicfix added the pr:feat label Jul 20, 2026
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.

1 participant