Uh oh!
There was an error while loading. Please reload this page.
fix(demos): pass the plugin explicitly when discovering gateways - #174
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
farhan-t-ottu
commented
Aug 24, 2026
@claude review |
Claude finished @farhan-t-ottu's task in 2m 14s —— View job Claude finished reviewing this PR
SummaryThe fix itself is sound: Finding
<ApiPanellabel="POST /b/checkout/v1/pymt-txn/"data={{type: "payment_request",// ← should be `type: PLUGIN`pg_codes: state.pgCodes,
...The actual request at line 349 correctly sends Minor observation (non-blocking)
Not verifiedI wasn't able to run |
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
Both points addressed in 2c56101. Finding — Verified in the browser against Minor observation —
|
farhan-t-ottu
commented
Aug 24, 2026
@claude review again |
Claude finished @farhan-t-ottu's task in 1m 12s —— View job Re-review complete ✅
Both items from the first pass are correctly resolved in
Additional verification this pass:
No new findings. The fix is complete and internally consistent. Not verified (same limitation as last pass): I don't have permission to execute |
Uh oh!
There was an error while loading. Please reload this page.
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 gateways the session type does not accept.Reproduced live against
sandbox.ottu.net:plugin: "payment_request"(what the demo sent)cbk-privateplugin: "e_commerce"cbk-privatedroppedWith the 13-code set → 201.
Changes
src/utils/sandbox.ts— addedPaymentPlugin("e_commerce" | "payment_request", matching the Checkout APItypeenum).callPaymentMethodsnow takespluginas a required argument, removing the?? "payment_request"default that hid this.CreateSessionOptions.typenarrowed fromstringtoPaymentPlugin.const PLUGINonce and uses it for both the Payment Methods call and the sessiontype, so the two can no longer drift apart.typethey already displayed in their request panels. RecurringDemo was renderingtype: "e_commerce"while actually sendingpayment_request.|| ({} as any)that widened the filter toanyand would have silently defeated the new required-plugincheck.Verification
Each demo driven in the browser with a
fetchrecorder capturing the real request bodies:plugin: "e_commerce"→ 200cbk-privateabsent from the 13 codesplugin: "e_commerce"→ 200type: "e_commerce"plugin: "payment_request"→ 200webhook:local)npm run typecheckandnpm run buildboth pass. Omittingplugin, a misspelled plugin, and a misspelled session type are all now compile errors.CheckoutDemo's SDK form then shows the SDK's own "Website doesn't run on non https pages" — that is the Ottu SDK refusing plain
http://localhost, raised only after both API steps succeeded. It does not occur on the deployed https site.Note for reviewers
This will not be visible on docs.ottu.dev yet.
ACTIVE_CONNECT = KSA, and that merchant has a separate failure tracked in #159192: its demo gateways span KWD/USD/SAR default currencies and Connect rejects a session mixing two foreign defaults (a missing Currency Exchange entry). This PR takes effect onmain/SANDBOX, or ondevonce #159192 is resolved.🤖 Generated with Claude Code