Skip to content

feat(billing): config-gate allow_promotion_codes on subscription Checkout (#3793)#3794

Merged
PierreBrisorgueil merged 1 commit into
masterfrom
feat/billing-promo-codes-gate
Jun 4, 2026
Merged

feat(billing): config-gate allow_promotion_codes on subscription Checkout (#3793)#3794
PierreBrisorgueil merged 1 commit into
masterfrom
feat/billing-promo-codes-gate

Conversation

@PierreBrisorgueil

Copy link
Copy Markdown
Contributor

Summary

  • Adds allow_promotion_codes to the subscription Checkout session, gated on config.stripe.allowPromotionCodes === true (strict, default OFF)
  • Mirrors the existing automaticTax pattern exactly (placement, style, config access path)
  • Extras-pack Checkout (createExtrasCheckout) left unchanged — one-time payment, no promo-code use-case
  • Fixes doc/code drift in STRIPE_SETUP.md: removes false claim that the flag was already passed unconditionally

Behavior

Config Result
allowPromotionCodes absent allow_promotion_codes not sent to Stripe (default)
allowPromotionCodes: false not sent
allowPromotionCodes: 1 (truthy non-strict) not sent — strict === true guard
allowPromotionCodes: true allow_promotion_codes: true passed to Stripe Checkout

Downstreams opt in via config.stripe.allowPromotionCodes: true in their defaults/<project>.config.js. Existing comes/montaine/pierreb/ism are unaffected.

Test plan

  • 4 new unit tests in billing.checkout.unit.tests.js: absent → undefined, false → undefined, truthy-non-strict (1) → undefined, true → present
  • All 1728 unit tests pass locally (43 in billing.checkout.unit suite)
  • ESLint: no issues

Closes #3793

…kout (#3793)

Mirror the automaticTax pattern: set checkoutParams.allow_promotion_codes = true
only when config.stripe.allowPromotionCodes === true (strict, default off).
Existing downstreams (comes/montaine/pierreb/ism) are unaffected.
Extras-pack Checkout left unchanged (one-time payment, no coupon use-case).
Fix false claim in STRIPE_SETUP.md (doc/code drift).
Add 4 unit tests: absent/false/truthy-non-strict → absent; true → present.
Copilot AI review requested due to automatic review settings June 4, 2026 15:38
@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@PierreBrisorgueil, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 5 minutes and 48 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d3fc79a5-6131-41b9-9508-6e9d1c55c6fc

📥 Commits

Reviewing files that changed from the base of the PR and between 428fb18 and 3aa7a99.

📒 Files selected for processing (3)
  • modules/billing/STRIPE_SETUP.md
  • modules/billing/services/billing.service.js
  • modules/billing/tests/billing.checkout.unit.tests.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/billing-promo-codes-gate

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI 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.

Pull request overview

Adds an opt-in, strict config gate for Stripe Checkout promo codes on subscription checkouts, aligning behavior with the existing automaticTax pattern and correcting documentation drift.

Changes:

  • Add checkoutParams.allow_promotion_codes = true when config?.stripe?.allowPromotionCodes === true in createCheckout.
  • Add unit coverage for the new config gate (absent/false/truthy-non-true/true).
  • Update modules/billing/STRIPE_SETUP.md to reflect that promo codes are config-gated (not unconditional).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
modules/billing/services/billing.service.js Config-gates allow_promotion_codes for subscription Checkout sessions with a strict === true guard.
modules/billing/tests/billing.checkout.unit.tests.js Adds unit tests validating the allowPromotionCodes gate behavior across key config values.
modules/billing/STRIPE_SETUP.md Fixes doc/code drift by documenting the config-gated nature of promo codes on hosted Checkout.

@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.23%. Comparing base (cdacb9b) to head (3aa7a99).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3794      +/-   ##
==========================================
+ Coverage   90.19%   90.23%   +0.03%     
==========================================
  Files         152      152              
  Lines        5020     5028       +8     
  Branches     1598     1600       +2     
==========================================
+ Hits         4528     4537       +9     
+ Misses        387      386       -1     
  Partials      105      105              
Flag Coverage Δ
integration 59.06% <0.00%> (+<0.01%) ⬆️
unit 69.64% <100.00%> (+0.30%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 853b36b...3aa7a99. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@PierreBrisorgueil PierreBrisorgueil merged commit 690e756 into master Jun 4, 2026
9 checks passed
@PierreBrisorgueil PierreBrisorgueil deleted the feat/billing-promo-codes-gate branch June 4, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

billing: config-gate allow_promotion_codes on subscription Checkout + fix STRIPE_SETUP.md drift

2 participants