iiitl / iiitl/Tap2Eat

[bug]: Checkout Page does not pass updated cart amount to Stripe Payment Intent

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
bug medium
Dominant language
Kotlin
Stars
0
Forks
7
PR merge metrics
No merged PRs in 30d

Description

On the `CheckoutPage`, if a user adjusts cart quantities using the embedded `CartFragment`, the total price displayed on the UI correctly updates in real time. However, the `amount` passed to the Stripe Payment Gateway is still the **original value captured during `onCreate`** — it never reflects the user's latest changes.

This is a critical billing bug. If a user increases their cart quantity at the last moment before paying, they will be charged the old, lower amount. If they decrease it, they will be overcharged. In either case, the amount Stripe processes is incorrect and out of sync with what the user sees on screen.

## Current Behavior

The `amount` passed to the Stripe `PaymentIntent` is read once during `onCreate` and never updated. Any quantity changes made via `CartFragment` after the page loads update the displayed total correctly — but the Stripe charge amount remains frozen at the original value.

## Expected Behavior

Whenever a user modifies item quantities in the cart on the `CheckoutPage`, the `amount` used to generate the Stripe `PaymentIntent` is updated dynamically. Tapping the "Pay" button always uses the latest, correct total that matches what is displayed on screen.

## Acceptance Criteria

- [ ] `CheckoutPage.kt` maintains a `currentAmount` variable that is updated whenever cart quantities change.
- [ ] The "Pay" button reads `currentAmount` at the time of tap — not the value from `onCreate`.
- [ ] The amount shown in the Stripe payment sheet exactly matches the total displayed on the `CheckoutPage` UI.
- [ ] The app compiles and runs without crashes after the fix.
- [ ] A screen recording demonstrating the Stripe sheet reflecting the updated amount after a quantity change is attached to the PR.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading CheckoutPage.kt and tracing how CartFragment quantity changes reach the checkout total and Stripe PaymentIntent. Verify the Pay action uses the latest displayed amount, then run the app and confirm the Stripe payment sheet matches after increasing and decreasing quantities.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile, payments
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.