Uh oh!
There was an error while loading. Please reload this page.
fix(demos): pass the plugin explicitly when discovering gateways - #175
Merged
farhan-t-ottu merged 2 commits intoAug 24, 2026
Merged
Conversation
CheckoutDemo called callPaymentMethods without a plugin, which silently defaulted to payment_request, then created the session with type: "e_commerce". On sandbox.ottu.net that discovery returns cbk-private, which is not enabled for the e-commerce plugin, so the Checkout API rejected the session: 400 ["pg code `cbk-private` is not enabled for `e_commerce` plugin."] Each demo now declares its plugin once and uses it for both the Payment Methods call and the session type, so the two can no longer drift apart. callPaymentMethods takes plugin as a required PaymentPlugin, removing the default that hid this; RecurringDemo and PaymentJourney also send the type they already display in their request panels. Refs #159191
Addresses PR review on #174. PaymentJourney's Step 3 request panel still hardcoded type: "payment_request" while the real call used PLUGIN. Harmless today because they happen to match, but it is the exact drift this branch removes, so the panel now reads PLUGIN as well. CreateSessionOptions.type is now required, dropping its ?? "payment_request" fallback. That silent default is the same footgun that caused #159191 on the discovery side; every call site already passes type explicitly, so this is a type-level change only. Refs #159191
farhan-t-ottu
commented
Aug 24, 2026
ContributorAuthor
@claude review |
Claude finished @farhan-t-ottu's task in 1m 20s —— View job Review complete
Verdict: LGTM. This is a clean, well-scoped fix — the root cause analysis holds up and the diff matches exactly what the description claims. What I checked
Minor notes (non-blocking)
|
jab3z
approved these changes
Aug 24, 2026
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Production (
main) counterpart of #174, which targetsdev. Same two commits, cherry-picked.Fixes the interactive Checkout SDK demo failing at the Creating session step.
Refs #159191
Root cause
CheckoutDemoInner.tsxcalledcallPaymentMethodswithout aplugin, whichcallPaymentMethodssilently defaulted topayment_request, and then created the session withtype: "e_commerce". Gateways are enabled per plugin, so discovery returned a gateway the session type does not accept.This branch matters more than #174:
mainrunsACTIVE_CONNECT = SANDBOX, which is the merchant the bug actually reproduces on.plugin: "payment_request"(what the demo sent)cbk-privateplugin: "e_commerce"cbk-privatedroppedChanges
src/utils/sandbox.ts— addedPaymentPlugin("e_commerce" | "payment_request", matching the Checkout APItypeenum).pluginoncallPaymentMethodsandtypeonCreateSessionOptionsare both now required, removing the two?? "payment_request"defaults that hid this.type, including theApiPanelrequest previews, so the displayed request cannot drift from what is sent.|| ({} as any)that widened the filter toanyand would have silently defeated the new required-plugincheck.Cherry-pick notes
mainanddevdiffer in this area, so reviewers should confirm nothing dev-only leaked. Verified — the diff againstmainis only the plugin fix, and these stay untouched:ACTIVE_CONNECT = SANDBOXand itsdocs.ottu.comcomment block (dev hasKSA)walletDemoConfig.tskeepscurrency: "USD"/10.00/8.00forottu-sandbox-usd(dev uses KWD)tagged "demo"wordingVerification
Run on this branch against
sandbox.ottu.net(main's own merchant), driving each demo in the browser with afetchrecorder capturing real request bodies:plugin: "e_commerce"→ 200cbk-privateabsentplugin: "e_commerce"→ 200type: "e_commerce"plugin: "payment_request"→ 200typefrom the constantplugin: "e_commerce"→ 200, returnsottu-sandbox-usdnpm run typecheckandnpm run buildboth pass. Omittingplugin, omittingtype, or misspelling either is now a compile error.WalletDemo's seed step returns
502 {"error":"keycloak_error","message":"Missing Keycloak client secret for backend@sandbox.ottu.net"}locally —SANDBOX_KEYCLOAK_CLIENT_SECRETis not in my.env.local, so the flow stops before session creation. Unrelated to this change: step 1 (the call this PR touches) succeeds, and the step 3 change istype: "e_commerce"→type: filter.pluginwherefilter.plugin === "e_commerce", an identical value. Worth a re-run by someone holding that secret.🤖 Generated with Claude Code