Skip to Content
Docs

Configuration

Control which elements render, how payment methods behave, and which methods appear in the Universal checkout form.

Universal checkout accepts several top-level options on checkout.universal() that go beyond visual styling. Use these to control what the checkout displays, how payment method selection works, and which methods are available to the customer.

Checkout-level toggles

Pass a toggles object at the top level of checkout.universal() to control form-wide display options. These are separate from the card-form-specific toggles described on the Card form page.

KeyDefaultDescription
submitButtontrueSet to false to hide the built-in submit button.
titleNoneA title string to display above the entire checkout form.
savedCardsBinsfalseShow the card BIN alongside the last 4 digits on saved cards. Set to true to show the default number of digits, or a number between 2 and 6 to control how many BIN digits appear.
savedPaymentMethodInlineCvvfalseRender the CVV field inline on a saved payment method row.
allowOnlyExistingPaymentMethodsfalseShow only the customer's saved payment sources. New card entry and other payment methods are hidden.
disablePaymentMethodDeletionfalsePrevent the customer from removing saved payment sources.
checkout.universal({
  container: '#pay-com-checkout',
  toggles: {
    title: 'Complete your purchase',
    savedCardsBins: 4,
    disablePaymentMethodDeletion: true,
  }
})

To restrict the checkout to saved payment methods only (for example, for returning subscribers), set allowOnlyExistingPaymentMethods to true. The customer won't see the new card form or any APM buttons.

Payment method options

These top-level options on checkout.universal() control which payment methods appear and how the customer selects them.

KeyTypeDefaultDescription
paymentMethodsstring[]NoneRestrict the payment methods shown in the form. Only the payment method types you list appear, for example ['card', 'applepay', 'googlepay'].
selectedPaymentMethodstringNonePreselect a payment method when the form renders. The customer can still switch to another method.
alternatives'button' | 'radio''button'Layout style for alternative payment method options. 'button' renders each as a clickable button. 'radio' renders radio inputs.
onValidateSession(data) => Promise<boolean>NoneAn async function called when the customer starts a payment with any method. Return true to let the payment proceed, or false to block it. Replaces the deprecated apmsOnClickValidation.
checkout.universal({
  container: '#pay-com-checkout',
  paymentMethods: ['card', 'applepay', 'googlepay'],
  selectedPaymentMethod: 'card',
  alternatives: 'radio',
})

Validate before a payment starts

Use onValidateSession to run custom checks when the customer starts a payment, for example to make sure a shipping address is filled in.

checkout.universal({
  container: '#pay-com-checkout',
  onValidateSession: async ({ paymentMethodType }) => {
    const addressComplete = await validateShippingAddress()
    return addressComplete
  },
})

If the function returns false, the payment doesn't proceed. See Validate a session for the data it receives and when it runs.

apmsOnClickValidation is deprecated. It runs only when an alternative payment method payment starts, and only if onValidateSession isn't set. Use onValidateSession instead.

Next steps

Was this page helpful?