Skip to content

[checkout][P1 HIGH] Org WALLET-rail checkout succeeds server-side but the page still opens the Razorpay widget on the synthetic org_wallet_ id and alerts "Payment Failed" #1437

Description

@teetangh

Found 2026-09-04 on the deploy preview of #1422 (Razorpay Test Mode E2E, flow D).

POST /api/checkout on the WALLET rail correctly confirms synchronously: Payment SUCCEEDED with a WALLET leg for the full amount, BillingAccount.walletBalance debited, Appointment APPROVED, and the response carries paymentIntent.id = org_wallet_<ts>_<rand> with no gateway order. The checkout page then calls razorpay.open() with that id anyway; Razorpay's preferences call answers 400 and the page shows a native alert "Oops! Something went wrong. Payment Failed." over a booking that already succeeded. A member or org admin will believe the booking failed and try again.

Fix: in the shared post-checkout handler of the four checkout pages (app/checkout/plans/{consultation,subscription,webinar,class}/[planId]/page.tsx, or the shared helper in app/checkout/plans/utils.ts), branch on the response before opening any gateway: when the payment is already SUCCEEDED (WALLET / LICENSE / zero-amount / mock) route straight to the success screen, the same way the mock and zero-amount paths are already special-cased. Evidence rows: Payment 7be6621a-…, org cmqb27k4606fvtxyol12naydf.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MgadJydWEKkdhhzY58yiL7

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnterpriseEnterprise tier — B2B org features, Architecture 4bugSomething isn't workingfinancePayments, refunds, earnings, payouts, invoicing, ledgerlaunch: pre-mvpGates launch — money, data, or a failure we would not detect

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions