Skip to Content
Docs

Render the checkout form

Render the hosted Pay.com checkout form inside a container element on your page.

The checkout.universal() method renders the hosted Pay.com checkout form inside a container element on your page. The form includes card fields, wallet buttons, saved payment methods, APM buttons, and a submit button.

Universal checkout with card fields, a save-card checkbox, and a Pay button
const universal = checkout.universal(options)

Parameters

ParameterTypeRequiredDescription
containerstringYesCSS selector for the DOM element the form renders in, for example '#pay-com-checkout'.
styleobjectNoStyle override object for the form's visual appearance. See the customization guide and the style object reference.
togglesobjectNoCheckout-level display toggles. See Configuration.
toggles.submitButtonbooleanNoSet to false to hide the built-in submit button. Default: true.
toggles.titlestringNoA title string to display above the checkout form.
toggles.savedCardsBinsboolean | numberNoShow the card BIN on saved cards. true for the default number of digits, or a number from 2 to 6. Default: false.
toggles.savedPaymentMethodInlineCvvbooleanNoRender the CVV field inline on a saved payment method. Default: false.
toggles.allowOnlyExistingPaymentMethodsbooleanNoShow only saved payment sources. Default: false.
toggles.disablePaymentMethodDeletionbooleanNoPrevent the customer from removing saved sources. Default: false.
cardFormobjectNoCard form configuration, including toggles and field configuration.
cardForm.togglesobjectNoCard-form-specific toggles. See Card form toggles.
cardForm.formConfigobjectNoField labels, placeholders, and error message styles. See Card form.
paymentMethodsstring[]NoRestrict the payment methods shown to the types you list, for example ['card', 'applepay', 'googlepay'].
selectedPaymentMethodstringNoPreselect a payment method when the form renders.
alternatives'button' | 'radio'NoLayout style for alternative payment methods. 'button' renders each APM as a clickable button. 'radio' renders a radio button list. Some payment methods (for example, iDEAL) appear only when it's 'radio'. Default: 'button'.
onValidateSession(data: ValidateSessionData) => Promise<boolean>NoRuns when the customer starts a payment with any method. Return false to block it. See Validate a session. Replaces the deprecated apmsOnClickValidation.
localizationsobjectNoMulti-language string overrides. See Localization.

With alternatives: 'radio', the form lists the payment methods as radio options:

Universal checkout listing Card, PayPal, and iDEAL as radio options

Returns

An object with setDisabled(disabled: boolean), which disables or enables the rendered form. The form renders inside the specified container.

Example

// Basic render
checkout.universal({
  container: '#pay-com-checkout'
})

// With a custom submit button
checkout.universal({
  container: '#pay-com-checkout',
  toggles: { submitButton: false }
})

// Restrict to specific payment methods with a pre-selection
checkout.universal({
  container: '#pay-com-checkout',
  paymentMethods: ['card', 'applepay', 'googlepay'],
  selectedPaymentMethod: 'card',
})

// Show APMs as radio buttons (required for iDEAL in Universal checkout)
checkout.universal({
  container: '#pay-com-checkout',
  alternatives: 'radio',
})

// Saved-cards-only checkout for returning customers
checkout.universal({
  container: '#pay-com-checkout',
  toggles: {
    allowOnlyExistingPaymentMethods: true,
    disablePaymentMethodDeletion: true,
    savedCardsBins: 4,
  }
})
Was this page helpful?