-
Notifications
You must be signed in to change notification settings - Fork 11.5k
feat: allow coupons on booking payment page #25856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: allow coupons on booking payment page #25856
Conversation
|
Someone is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 9 files
Prompt for AI agents (all 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="apps/web/app/(use-page-wrapper)/payment/[uid]/PaymentPage.tsx">
<violation number="1" location="apps/web/app/(use-page-wrapper)/payment/[uid]/PaymentPage.tsx:146">
P1: Using `||` instead of `??` causes incorrect price display for 100% discount coupons. When `displayAmount` is 0, it falls back to the original payment amount instead of showing the discounted price (free).</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
|
6d6b5ba to
d6ecfef
Compare
|
✅ Fixed Stripe webhook guard logic. Previously platform events ( Demo video attached below. 2025-12-14.13-50-06.copy.mp4 |
|
SofienBAT
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! 👏
|
This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 5 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="apps/web/pages/api/payment/confirm-free.ts">
<violation number="1" location="apps/web/pages/api/payment/confirm-free.ts:193">
P1: The condition `!locked.ok` will never be true since the transaction always returns `{ ok: true as const, ... }`. This is dead code and also means `handlePaymentSuccess` will be called even for already-successful payments. Consider adding an `alreadyProcessed` flag when returning early for payments where `lockedPayment.success` is true, then check that flag here to skip `handlePaymentSuccess`.</violation>
</file>
Reply to cubic to teach it or ask questions. Tag @cubic-dev-ai to re-run a review.
Allow Stripe Coupons on Booking Payment Page
Summary
This PR adds support for applying Stripe coupon codes directly on the booking payment page.
Users can now enter a promo code during checkout, have it validated via Stripe, and see the discounted price before confirming the booking.
Changes
1. Booking Payment Flow
File:
apps/web/app/(use-page-wrapper)/payment/[uid]/PaymentPage.tsx/api/payment/promo-codeendpoint to validate codes.2. Promo Code API
File:
apps/web/pages/api/payment/promo-code.tsNew API route to validate Stripe coupon codes.
Receives the promo code and payment context, calls Stripe, and returns:
Designed to be reusable for future payment flows if needed.
3. App Store & Stripe Payment Configuration
Files:
packages/app-store/_utils/payments/getPaymentAppData.tspackages/app-store/stripepayment/components/EventTypeAppSettingsInterface.tsxpackages/app-store/stripepayment/zod.tsChanges:
4. Payment Component Logic
File:
packages/features/ee/payments/components/Payment.tsxWired promo code support into the existing payment logic.
Ensures that:
5. Platform Atom for Stripe Payment Form
File:
packages/platform/atoms/event-types/payments/StripePaymentForm.tsxAdded props and UI elements to support:
Ensures a clear separation between presentation (form) and business logic (API + payment component).
6. UI Package Adjustments
File:
packages/ui/package.json7. Localization
File:
apps/web/public/static/locales/en/common.jsonAdded English translation keys for:
Screenshots
How It Works (High-Level)
User lands on the booking payment page with Stripe as the payment app.
User enters a promo code and clicks Apply.
Frontend calls
POST /api/payment/promo-codewith the code and booking/payment context.The API validates the coupon with Stripe and returns:
The payment form updates the UI and uses the discounted amount for the final Stripe payment.
Testing
Manually tested:
Closes #12462