Skip to main content
This page is the complete API reference for every event and instance method exposed by Primer Checkout. Each entry documents the event name, when it dispatches, its payload shape, and the TypeScript types involved.
For integration guidance — where to listen, which events to combine, and real-world implementation patterns — see the Events Guide.

Quick navigation


Event lifecycle


DOM events

All Primer events are CustomEvent objects dispatched with bubbles: true and composed: true, allowing them to propagate through shadow DOM boundaries.

Initialization events

primer:ready

Dispatched once when the SDK is fully initialized. Payload: PrimerJS instance The PrimerJS instance is the primary interface for invoking SDK methods. See PrimerJS Instance Methods for the full surface.

primer:methods-update

Dispatched when available payment methods are loaded. Also re-dispatched after refreshSession(). Payload: InitializedPaymentMethod[] The payload is an array of available payment methods.

State events

primer:state-change

Dispatched when SDK state changes during the payment lifecycle. Fires multiple times during a single payment flow. Payload: SdkState

Card form events

primer:bin-data-available

Dispatched when BIN data is detected from user input in the card number field. Provides card network information, co-badged network alternatives, and additional issuer details when available. Payload: BinDataAvailableEvent

primer:bin-data-loading-change

Dispatched when BIN data retrieval starts or finishes. Use this to show a loading indicator while card information is being fetched from Primer’s servers. Payload: BinDataLoadingChangeEvent

primer:card-success

Dispatched when card form submission succeeds. Payload: CardSubmitSuccessPayload

primer:card-error

Dispatched when card form validation fails on submission. Payload: CardSubmitErrorsPayload

Payment events

primer:payment-start

Dispatched when payment creation begins. Use event.preventDefault() to intercept the payment flow for validation. Payload: PaymentStartData
If you call event.preventDefault(), you must call either continuePaymentCreation() or abortPaymentCreation(). If neither is called, the payment will hang indefinitely.

primer:payment-success

Dispatched when payment completes successfully. Payload: PaymentSuccessData

primer:payment-failure

Dispatched when payment fails. Payload: PaymentFailureData

primer:payment-cancel

Dispatched when a payment is cancelled by the user (e.g., dismissing Apple Pay or closing a payment popup). Payload: PaymentCancelData

primer:payment-approval-required

Dispatched on a MANUAL approval session when the customer submits a payment. Primer tokenizes the payment method and prepares a payment attempt, but does not create the payment; it waits for your backend to approve or abort the attempt. See the Manual payment approval guide. Payload: PaymentApprovalRequiredData
If the page is refreshed while an attempt is still awaiting approval, this event is re-emitted. Deduplicate on paymentAttemptId so you don’t approve the same attempt twice.

Vault Events

primer:vault-methods-update

Dispatched when vaulted payment methods are loaded or updated. Payload: VaultedMethodsUpdateData

primer:vault-selection-change

Dispatched when a vaulted payment method is selected or deselected. Payload: VaultSelectionChangeData

primer:show-other-payments-toggled

Dispatched when the “show other payments” toggle state changes. Payload: ShowOtherPaymentsToggledPayload

Triggerable events

These events can be dispatched by your code to control the SDK. All triggerable events must be dispatched with bubbles: true and composed: true to cross shadow DOM boundaries.

primer:card-submit

Triggers card form submission programmatically.

primer:vault-submit

Triggers vault payment submission programmatically.

primer:show-other-payments-toggle

Toggles the “other payment methods” section.

PrimerJS instance methods

The PrimerJS instance is received from the primer:ready event.

refreshSession()

Synchronizes the client-side SDK with server-side session updates. Triggers a new primer:methods-update event.

getPaymentMethods()

Returns the cached list of available payment methods.

setCardholderName()

Sets the cardholder name field programmatically. Must be called after primer:ready.

Vault API

vault.createCvvInput()

Creates a CVV input element for CVV recapture in headless mode.

vault.startPayment()

Initiates payment with the selected vaulted method.

vault.delete()

Deletes a vaulted payment method.
For a complete headless vault implementation walkthrough, see the Headless Vault Guide.

Type definitions

PaymentStartData

PaymentSuccessData

PaymentFailureData

PaymentCancelData

PaymentApprovalRequiredData

PaymentMethodToken

The tokenized payment method surfaced with the approval event. Exposes only non-sensitive fields.

PaymentSummary

A PCI-compliant payment summary with minimal PII exposure. Contains payment identifiers and filtered payment method data.

PaymentFailure

SdkState

BinDataAvailableEvent

BinDataDetails

BinDataLoadingChangeEvent

CardSubmitSuccessPayload

CardSubmitErrorsPayload

InputValidationError

VaultedMethodsUpdateData

VaultedPaymentMethodSummary

VaultSelectionChangeData

ShowOtherPaymentsToggledPayload

InitializedPaymentMethod


See also

Events guide

When, why, and how to use events in your integration

SDK options reference

Configuration options for <primer-checkout>

Headless vault guide

Custom vault UI implementation