Skip to content

fix(checkout): send cart total so /checkout can complete an order - #130

Open
sentry[bot] wants to merge 1 commit into
masterfrom
claude/fix-checkout-500-01LnmsdehbkWaR8V8wZGsdmQ
Open

fix(checkout): send cart total so /checkout can complete an order#130
sentry[bot] wants to merge 1 commit into
masterfrom
claude/fix-checkout-500-01LnmsdehbkWaR8V8wZGsdmQ

Conversation

@sentry

@sentry sentry Bot commented Sep 8, 2026

Copy link
Copy Markdown

Summary

This pull request was triggered by a Seer handoff from Sentry.

Placing an order returned 500 - INTERNAL SERVER ERROR from the Flask /checkout endpoint. The root cause was server-side: the endpoint's empty-cart guard read quantities before it was assigned, so every request raised an UnboundLocalError (fixed in sentry-demos/empower#1649).

While verifying that fix against the payload this app sends, a second, client-side problem showed up: on the successful checkout path the backend reads cart["total"], but this screen only sent items and quantities, so a fulfilled order would still fail with a KeyError. This change adds the cart total to the checkout payload so it matches the structure the backend (and the React web app) expects, and reuses that value for the existing totalValue success log instead of recomputing it.

Verification

  • Reproduced the backend's inventory/success logic against this app's exact payload — checkout now succeeds instead of erroring on the missing total
  • npx jest passes; npx eslint src/screens/CheckoutScreen.tsx reports no new findings versus master

Fixes MOBILE-REACT-NATIVE-62

The Flask /checkout endpoint reads `cart["total"]` when an order is
fulfilled, but the app only sent `items` and `quantities`, so the request
failed with a 500 once the backend reached the success path. Include the
cart total (the same value already logged as `totalValue`) so the payload
matches the structure the backend expects.

Fixes [MOBILE-REACT-NATIVE-62](https://demo.sentry.io/issues/7671831403/)
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.

1 participant