Skip to main content
Use your own submit button to trigger payment. On Web, place your button outside the <primer-checkout> component and dispatch a custom event. On Android, override the submitButton slot in PrimerCardForm with a custom Composable. On iOS, override the submitButton slot in PrimerCardForm with a custom SwiftUI view.

Recipe

How it works

  1. Place your custom button outside the <primer-checkout> component
  2. Listen for click events on your button
  3. Dispatch the primer:card-submit custom event to trigger form submission
  4. The event bubbles up to the card form and initiates the payment
The bubbles: true and composed: true options are required so the event can cross shadow DOM boundaries and reach the card form component.

Variations

Button with loading state

Programmatic submission with amount

Alternatively, you can call the submit method directly on the card form:

See also

Disable buttons during payment

Prevent double submission during payment processing

Build a custom card form

Step-by-step guide to building a fully custom card form