Skip to content

Drop-in throws TypeError on Enter key when onSubmit is not configured #3896

Description

@damusnet

Description

When a Drop-in is initialized without an onSubmit callback (a valid setup when the host app drives submission via its own button and uses the Drop-in only as an encrypted-field collector), pressing Enter inside any Drop-in input crashes with:

TypeError: undefined is not an object (evaluating 'this.makePaymentsCall().then')

Stacktrace

@adyen/adyen-web/src/components/Dropin/Dropin.tsx:242  Dropin.handleKeyPress
@adyen/adyen-web/src/components/internal/UIElement/UIElement.tsx:502  UIElement.handleKeyPress
@adyen/adyen-web/src/components/Dropin/Dropin.tsx:249  Dropin.onEnterKeyPressed
@adyen/adyen-web/src/components/internal/UIElement/UIElement.tsx:516  UIElement.onEnterKeyPressed
@adyen/adyen-web/src/components/internal/UIElement/UIElement.tsx:224  UIElement.setStatus

makePaymentsCall() returns undefined when no onSubmit is configured, and the Enter-key path then calls .then() on it unconditionally.

Reproduction

const checkout = await AdyenCheckout({
  clientKey: '...',
  environment: 'test',
  countryCode: 'US',
  showPayButton: false,
  // no onSubmit
  paymentMethodsResponse: {
    paymentMethods: [{ type: 'scheme', brands: ['visa'], name: 'Credit Card' }],
  },
})

new Dropin(checkout, {
  paymentMethodsConfiguration: {
    card: { billingAddressRequired: true, billingAddressRequiredFields: ['postalCode'] },
  },
}).mount('#dropin')
  1. Fill in card details.
  2. Focus the billing postal code field.
  3. Press Enter (or "Go" on a mobile keyboard).
  4. TypeError thrown from makePaymentsCall().then.

Reproduces on mobile Safari (iOS 18.7) and desktop browsers. We see ~140 occurrences across 113 users in production.

Expected behavior

Either:

  1. Guard makePaymentsCall to no-op (or warn) when no onSubmit is configured, instead of throwing.
  2. Throw a clear error at init time if a Drop-in is constructed without onSubmit, so integrators discover the misconfiguration immediately rather than via a runtime TypeError deep in a keypress handler.

A clearer error at init would have let us identify and fix our integration in minutes instead of triaging a cryptic Sentry stack.

Workaround

Provide a no-op onSubmit that resolves immediately:

onSubmit: (_state, _component, actions) => {
  actions.resolve({ resultCode: 'Received' })
}

Environment

  • @adyen/adyen-web: 6.33.0
  • Browser: Mobile Safari 26.1 / iOS 18.7 (also reproducible on desktop)
  • Framework: Next.js 16 + React 19

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions