Skip to content

[COMMEX-2267] Forward configured checkout payment methods - #1541

Merged
sgopalan-godaddy merged 3 commits into
mainfrom
codex/COMMEX-2267-google-pay-standard
Nov 20, 2026
Merged

sgopalan-godaddy merged 3 commits into
mainfrom
codex/COMMEX-2267-google-pay-standard

Conversation

@sgopalan-godaddy

@sgopalan-godaddy sgopalan-godaddy commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The server currently replaces managed paymentMethods with a hard-coded card configuration, preventing Airo apps from enabling Google Pay in standard hosted checkout. Read and validate the optional methods from GODADDY_CHECKOUT_CONFIGURATION, then forward them for cart, Buy Now, and trusted non-catalog sessions.

For Google Pay, both methods require the explicit Checkout API fields:

{
  "card": { "processor": "godaddy", "checkoutTypes": ["standard"] },
  "googlePay": { "processor": "godaddy", "checkoutTypes": ["standard"] }
}

Missing, empty, all-null, or malformed optional methods retain standard card checkout without resetting valid shipping, tax, or promotion flags. Environment settings and custom host readCheckout() values use the same payment validation. Padded processor and checkout-type strings are rejected. Valid cardless configurations are supported: the returned session must retain at least one configured method with its requested processor.

Invalid payment maps emit one invalid_checkout_payment_methods warning per checkout attempt through the configured logger, with a standard_godaddy_card fallback marker and no configuration values. Missing or valid settings do not warn. Existing error-only loggers remain compatible, using console.warn when no warning handler is available or it fails.

Payment methods remain server-owned; browser checkout inputs cannot override them. Forwarding a provider does not initialize its frontend SDK. This integration enables Google Pay through GoDaddy Payments; other providers still require their SDK configuration in hosted checkout. Apple Pay is outside this change.

Jira: COMMEX-2267, related to COMMEX-2168.

Changeset

  • Patch changeset added for @godaddy/gd-commerce-server.

Publish the fixed package before releasing the AAB dependency update. Existing apps need a resolved dependency and lockfile update, configuration refresh, rebuild, and redeploy; configuration delivery alone cannot upgrade bundled code.

Companion configuration bridge and Customer Care recovery: gdcorp-partners/airo-app-builder#14581, kept as a draft pending the package release.

Test Plan

  • pnpm --filter @godaddy/gd-commerce-server test: 389 tests passed.
  • Package typecheck, Biome lint, and build passed.
  • HTTP integration tests exercise environment and custom-host fallback through the router logger, preservation of tax collection, recovery to Google Pay after configuration correction, no duplicate warning, and no leaked configuration values. Missing and throwing warning handlers fall back to sanitized console warnings.
  • Warning regression sensitivity: temporarily suppressing the configured logger call failed both environment/host HTTP warning assertions; restored the exact source and reran all 389 tests successfully.
  • Regression tests cover cardless sessions, all-null/empty/malformed custom host settings, padded values, preserved tax collection, and returned processor validation across cart, Buy Now, and non-catalog checkout. The new tests reproduced the review blockers before the fixes.
  • Prior regression sensitivity check: temporarily accepting an empty method object failed the fallback assertion; the exact source was restored. Forwarding and server-ownership assertions remain covered.
  • The development Checkout API schema confirms that processor and checkoutTypes are required. Real preview cart and Buy Now requests returned HTTP 200 with checkout sessions using the corrected configuration.
  • The developer confirmed Google Pay checkout worked in the local preview. This used the locally built package and manually supplied configuration; it does not establish production rollout or AAB automatic delivery. This manual test preceded the review fixes above.

Bug-fix details

Configured wallet methods were ignored, so shoppers could not use Google Pay through the packaged checkout integration. An empty wallet object also fails Checkout API input validation; the parser rejects incomplete method settings before forwarding them. Shared validation prevents invalid custom host settings from bypassing the safe card fallback, and the response check accepts configured methods without requiring card.

@sgopalan-godaddy
sgopalan-godaddy requested a review from a team as a code owner November 20, 2026 20:35
@changeset-bot

changeset-bot Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c627605

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@godaddy/gd-commerce-server Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pbennett1-godaddy pbennett1-godaddy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three blocking issues are in the inline comments. They have one cause: what paymentMethods() accepts doesn't match what createCheckoutSession needs to succeed.

Non-blocking:

  • A configured method that the API drops goes undetected. After the session is created, promotion codes, tax and shipping are each checked against the response, but the configured payment methods aren't. If Google Pay is configured and the API returns only card, checkout works with no Google Pay and nothing is logged. A per-method check would match how the other flags are handled. It could also replace the card-only check in blocking comment 1.
  • Invalid config falls back silently. One bad entry, such as a typo like googlepay or an extra field, makes paymentMethods() return undefined and discards the whole map with no signal. Logging a warning with the reason would make it much easier to see why Google Pay is missing.
  • Values aren't trimmed before they're sent. processor and checkoutTypes use .trim() only to check for empty values, and the original strings are forwarded. So " godaddy " passes validation and goes upstream with the spaces. Either return trimmed copies or reject padded values.

)
return undefined;
}
return value as CheckoutSessionPaymentMethodsInput;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: some configs that pass this validator make every checkout throw.

The validator follows the API, where every method including card is optional and nullable. So { googlePay: {...} } and { card: null, googlePay: {...} } are accepted. But create-checkout-session.ts:312 still does this after the session is created:

if (!session.paymentMethods?.card?.processor) {
  throw new UpstreamError('Checkout session did not configure payment methods.');
}

That check was safe when the server always sent the card default. With configurable methods, a card-less config creates the session upstream and then throws, for every cart, Buy Now and non-catalog checkout. Each attempt also leaves an unused upstream session behind.

Since the API allows card-less sessions, I'd relax that check: throw only when none of the configured non-null methods comes back with a processor. If card-less checkout isn't meant to be supported, require a non-null card here and document that instead.

if (!isRecord(value) || Object.keys(value).length === 0) return undefined;
for (const [name, method] of Object.entries(value)) {
if (!PAYMENT_METHOD_NAMES.has(name as keyof CheckoutSessionPaymentMethodsInput)) return undefined;
if (method === null) continue;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: a map where every method is null passes as valid.

Because of this continue, { card: null } or { card: null, googlePay: null } is returned as a valid config instead of falling back to DEFAULT_CHECKOUT_PAYMENT_METHODS. Checkout then sends a session with no payment methods, which is the silent failure the default exists to prevent. The README says invalid payment settings fall back to standard card, but an all-null map doesn't.

Suggested fix: after the loop, require at least one non-null method and return undefined otherwise.

currencyCode: configCurrencyCode,
} = readReadyCommerceConfig(configuration);
const checkoutConfiguration = readReadyCheckoutConfig(configuration);
const paymentMethods = checkoutConfiguration.paymentMethods ?? DEFAULT_CHECKOUT_PAYMENT_METHODS;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: payment methods from a host's readCheckout() reach the Checkout API without validation.

Only undefined falls back to the default through ??. A host that returns paymentMethods: {} or a malformed map replaces the safe card default, and every checkout fails (see the comment on checkout-config.ts).

The README does say hosts supplying readCheckout() must validate their own values. But paymentMethods() already exists, so running host values through it here is a small change. An empty or invalid map would then fall back the same way the env path does. If you'd rather keep this as the host's job, consider at least treating {} as missing.

@pbennett1-godaddy pbennett1-godaddy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. 802dde3f fixes all three blocking issues:

  • Card-less configs: the check after the session is created now passes when any configured method comes back with the processor that was requested.
  • All-null maps: these now fall back to the card default.
  • Host readCheckout() values: these now go through the same validator as environment configuration.

Padded values are rejected too. Typecheck, tests and lint pass on this commit.

Non-blocking follow-up: invalid payment config still falls back with no log. One bad entry, such as a typo like googlepay or an extra field, makes parseCheckoutPaymentMethods return undefined, and the whole map is replaced by the card default. This now covers host readCheckout() values too. The result is that a builder can configure Google Pay, see card-only checkout and have nothing to explain why. A warning through the configured logger with the reason (unknown method name, extra field, invalid processor or checkoutTypes, no enabled methods) would make this easy to diagnose. The same logging would help when a configured method is dropped from the returned session but another one survives.

@sbolinger-godaddy sbolinger-godaddy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing major found, approving. One item you may want to address, but it's not a blocker:

  • Invalid paymentMethods config (e.g. a googlepay typo or an extra field) falls back to card-only with no log, same as Patrick noted. A warning through the configured logger would make missing Google Pay much easier to diagnose.

Verified: traced configured methods through cart, Buy Now, and non-catalog inputs and the response check; ran typecheck, lint, and tests for @godaddy/gd-commerce-server on Node 24 (383 passed). Did not exercise a live Checkout API or Google Pay flow.

@sgopalan-godaddy
sgopalan-godaddy merged commit b38edb8 into main Nov 20, 2026
3 checks passed
@sgopalan-godaddy
sgopalan-godaddy deleted the codex/COMMEX-2267-google-pay-standard branch November 20, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants