Skip to Content
Docs

Submit the form

Programmatically submit the Universal checkout form using a custom button.

The checkout.submit() method programmatically submits the Universal checkout form. Call it after a successful checkout.validate() when you use a custom submit button with toggles: { submitButton: false }.

const payment = await checkout.submit()

This method applies only to Universal checkout. For Headless checkout, use checkout.headless() to submit payments directly.

Parameters

None.

Returns

A promise that resolves with the payment result, the same PaymentResult object that onSuccess receives.

If the payment fails and throwOnSubmitFailure on pay.checkout() is true (the default), the promise rejects with a { message, data } object (not an Error instance). With throwOnSubmitFailure: false, it doesn't reject. Handle the failure in onFailure.

Example

try {
  const payment = await checkout.submit()
  console.log('Submitted:', payment?.transaction)
} catch (error) {
  console.log('Payment failed:', error.message)
}
Was this page helpful?