8000 fix(frontend,mobile): always charge in the base currency by 5eBeKs · Pull Request #69 · aelassas/movinin · GitHub
[go: up one dir, main page]

Skip to content

fix(frontend,mobile): always charge in the base currency - #69

Merged
aelassas merged 1 commit into
aelassas:mainfrom
5eBeKs:fix/charge-in-base-currency
Nov 4, 2026
Merged

aelassas merged 1 commit into
aelassas:mainfrom
5eBeKs:fix/charge-in-base-currency

Conversation

@5eBeKs
@5eBeKs 5eBeKs commented Nov 4, 2026
Copy link
Copy Markdown
Contributor

The backend accepts a payment only in MI_BASE_CURRENCY, but the checkout pages charge in the currency picked in the currency menu, so a non-base payment goes through and the booking is then rejected.

Example (MI_BASE_CURRENCY=USD, header set to EUR, 1,000 USD stay): the Checkout Session is created for the converted EUR amount in EUR, the card is charged, and checkCheckoutSession returns 400 "Payment currency mismatch". With this change the session is created for 1,000.00 USD; the page still shows the EUR figure as an estimate.

As agreed in #68 (option 1), the payment processor now always gets env.BASE_CURRENCY:

  • web, Stripe Checkout Session: the base price from calculateTotalPrice with the selected cancellation option, the same amount the server checks;
  • web, PayPal: the order and the SDK use env.BASE_CURRENCY (the server already takes the amount from booking.price);
  • mobile, PaymentIntent and the Google Pay currency in the payment sheet: base price and env.BASE_CURRENCY; app users get this with the next app update;
  • booking.price sent to /api/checkout is that base price instead of converting the displayed price back (the server recomputes it anyway).

Displayed prices are unchanged. Backend checks are untouched. The Monthly/Yearly month-boundary case mentioned in #68 is not addressed here.

Question: Stripe and PayPal will show the USD amount while the page shows EUR. Would you like a short note such as "charged in USD" next to the total? I left it out to keep this PR to the fix.

Tests: frontend and mobile have no test setup, so no new tests; frontend and mobile lint and tsc pass. In backend, lint passes and npm run test passes except the three booking.test.ts cases that need a real Stripe key; they fail the same way without this change.

Closes #68

@aelassas
aelassas merged commit f8dce05 into aelassas:main Nov 4, 2026
1 check passed
aelassas added a commit that referenced this pull request Nov 4, 2026
- stripe/paypal: reject payments whose currency is not the base currency and
  always create Stripe sessions/intents and PayPal orders in BASE_CURRENCY
- booking: use half-open [from, to) overlap in checkout, consistent with
  search, so a booking ending on a day no longer blocks one starting that day
- booking: treat properties without blockOnPay as non-blocking by setting
  blockOnPay=false at startup, fixing 409 on checkout for legacy properties
- frontend: always re-run the search on submit, keep the search when the user
  changes, load the full location and ignore stale property list responses
- tests: cover base currency checks, back-to-back bookings and blockOnPay init
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.

Paying in a non-base currency charges the customer but the booking is never confirmed

2 participants

0