Primer Platform
Client Session
Client Session
A server-side object you create through the Primer API before rendering the checkout. The client session holds everything Primer needs to present the correct payment experience: the order amount, currency, customer information, and which payment methods are available. Creating a client session returns a client token.
Client Token
Client Token
A short-lived string returned when you create a client session. You pass it to
<primer-checkout> via the client-token attribute to initialize the checkout. The token authenticates the session and carries the configuration the SDK needs to render payment methods and process payments.Primer Dashboard
Primer Dashboard
The web interface where you configure your Primer account. From the Dashboard you can enable payment methods, set up processors, manage API keys, and configure checkout behavior — all without changing your frontend code.
Diagnostics ID
Diagnostics ID
A unique identifier attached to every error the SDK produces. When you contact Primer support about a failed payment or unexpected behavior, include the
diagnosticsId so the team can locate the exact request in their logs.SDK & Architecture
Primer Checkout Web SDK
Primer Checkout Web SDK
The JavaScript package (
@primer-io/primer-js) that provides the checkout UI components, payment logic, and event system. You install it via npm and call loadPrimer() to register the web components in the browser.Web Components
Web Components
A set of browser-native APIs for creating reusable, encapsulated UI elements. Primer Checkout is built on Web Components, which means its elements (like
<primer-checkout> and <primer-card-form>) work in any framework — React, Vue, Svelte, or plain HTML — without adapters or wrappers. See Core Concepts for more detail.Shadow DOM
Shadow DOM
A browser feature that isolates a component’s internal HTML and CSS from the rest of the page. Every Primer component uses Shadow DOM, which prevents your styles from accidentally breaking the checkout and prevents checkout styles from leaking into your app. Because external CSS selectors can’t reach inside the Shadow DOM, you customize appearance through CSS variables instead.
Slot
Slot
A named placeholder inside a Web Component where you can insert your own content. Primer components expose slots so you can control layout and inject custom elements without modifying internal markup. For example, the
main slot on <primer-checkout> and the payments slot on <primer-main>. See Layout Customization.CSS variables (Design Tokens)
CSS variables (Design Tokens)
CSS variables (e.g.
--primer-color-brand) that Primer exposes as its styling API. Because CSS variables can cross Shadow DOM boundaries, they are the supported way to customize colors, spacing, typography, border radius, and other visual aspects of checkout components. Primer’s documentation sometimes refers to these as design tokens. See the Design Tokens Explorer.Hosted Input
Hosted Input
A card input field (card number, expiry, CVV) that renders inside a secure iframe managed by Primer. Sensitive card data is captured directly by Primer’s servers and never touches your page’s DOM, keeping your integration PCI-compliant without additional certification effort.
Payment Concepts
Payment Method
Payment Method
A way for a customer to pay — for example, a credit card, PayPal, Apple Pay, or Google Pay. Available payment methods are configured in the Primer Dashboard and delivered to the SDK through the client session. In code, each method has a
type string such as PAYMENT_CARD, PAYPAL, or APPLE_PAY.Payment Method Type
Payment Method Type
The string identifier for a specific payment method. You’ll see it in event payloads (e.g.
paymentMethodType: 'PAYMENT_CARD') and as the type attribute on <primer-payment-method>. Common values include PAYMENT_CARD, PAYPAL, APPLE_PAY, GOOGLE_PAY, and KLARNA.Vault / Vaulted Payment Methods
Vault / Vaulted Payment Methods
Primer’s system for securely storing a customer’s payment details for future use. When vaulting is enabled, returning customers can pay with a saved card or payment method without re-entering their details. The SDK exposes vault data through the
primer:vault-methods-update event and the <primer-vault-manager> component. See SDK Options — Vault.Payment Instrument Data
Payment Instrument Data
The details associated with a saved (vaulted) payment method. For a stored card this includes properties like
network (e.g. VISA), last4Digits, expirationMonth, and expirationYear. You access it via the paymentInstrumentData property on a vaulted payment object.PCI Compliance
PCI Compliance
The Payment Card Industry Data Security Standard (PCI DSS) — a set of requirements for any system that handles credit card data. Primer Checkout’s hosted inputs handle card data inside secure iframes so that sensitive information never enters your page, significantly reducing your PCI compliance scope.
3DS (3D Secure)
3DS (3D Secure)
An authentication protocol that adds a verification step during card payments, typically a bank-issued challenge screen or biometric prompt. Primer Checkout handles 3DS flows automatically — including rendering challenge screens and processing the result — with no additional code required.
Events
primer:ready
primer:ready
The event fired when the SDK has fully initialized and is ready for interaction. Inside this event’s handler you access the PrimerJS instance (
event.detail) which provides SDK methods like refreshSession(), getPaymentMethods(), and setCardholderName(). See Events Guide.primer:state-change
primer:state-change
The event fired whenever the checkout’s state changes. The event detail includes boolean flags like
isProcessing (payment is in progress) and isSuccessful (payment completed), as well as error objects like paymentFailure and primerJsError. Use it to drive UI updates such as loading spinners, button states, and error messages.primer:methods-update
primer:methods-update
The event fired when the SDK has determined which payment methods are available for the current session. The event detail provides the list of methods, which you can use to dynamically render
<primer-payment-method> elements.primer:payment-success / primer:payment-failure
primer:payment-success / primer:payment-failure
The events fired after a payment completes.
primer:payment-success fires after a successful payment and the event detail includes the payment summary (order ID, last 4 digits, network). primer:payment-failure fires after a failed payment and includes the error object with the diagnosticsId. These are your primary integration points for redirects, confirmations, and error logging.primer:payment-start
primer:payment-start
The event fired when payment creation begins. You can intercept this event with
event.preventDefault() to run validation before the payment is created. The event detail includes continuePaymentCreation() and abortPaymentCreation() handlers to control the payment flow. See Events Guide for usage.Components
primer-checkout
primer-checkout
The root component that initializes the SDK and provides context for all child components. It accepts the
client-token attribute and dispatches top-level events like primer:ready and primer:state-change.primer-main
primer-main
The layout component that renders the default checkout UI inside
<primer-checkout>. It provides the payments and checkout-complete slots for layout customization. You can bypass it entirely for fully custom implementations.primer-card-form
primer-card-form
A container component that provides context for card input fields. It must wrap all card input components (
primer-input-card-number, primer-input-card-expiry, primer-input-cvv, primer-input-cardholder-name). See Build a Custom Card Form.primer-payment-method
primer-payment-method
A component that renders a specific payment method’s UI. Set the
type attribute to the desired payment method type (e.g. PAYMENT_CARD, PAYPAL). If the specified method isn’t available in the current session, the component renders nothing.primer-vault-manager
primer-vault-manager
A component that manages the display and interaction of saved (vaulted) payment methods for returning customers.
primer-error-message-container
primer-error-message-container