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.
const universal = checkout.universal(options)Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
container | string | Yes | CSS selector for the DOM element the form renders in, for example '#pay-com-checkout'. |
style | object | No | Style override object for the form's visual appearance. See the customization guide and the style object reference. |
toggles | object | No | Checkout-level display toggles. See Configuration. |
toggles.submitButton | boolean | No | Set to false to hide the built-in submit button. Default: true. |
toggles.title | string | No | A title string to display above the checkout form. |
toggles.savedCardsBins | boolean | number | No | Show the card BIN on saved cards. true for the default number of digits, or a number from 2 to 6. Default: false. |
toggles.savedPaymentMethodInlineCvv | boolean | No | Render the CVV field inline on a saved payment method. Default: false. |
toggles.allowOnlyExistingPaymentMethods | boolean | No | Show only saved payment sources. Default: false. |
toggles.disablePaymentMethodDeletion | boolean | No | Prevent the customer from removing saved sources. Default: false. |
cardForm | object | No | Card form configuration, including toggles and field configuration. |
cardForm.toggles | object | No | Card-form-specific toggles. See Card form toggles. |
cardForm.formConfig | object | No | Field labels, placeholders, and error message styles. See Card form. |
paymentMethods | string[] | No | Restrict the payment methods shown to the types you list, for example ['card', 'applepay', 'googlepay']. |
selectedPaymentMethod | string | No | Preselect a payment method when the form renders. |
alternatives | 'button' | 'radio' | No | Layout 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> | No | Runs when the customer starts a payment with any method. Return false to block it. See Validate a session. Replaces the deprecated apmsOnClickValidation. |
localizations | object | No | Multi-language string overrides. See Localization. |
With alternatives: 'radio', the form lists the payment methods 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?