Skip to main content

Prerequisites

You’ll need your clientToken to initialize Primer Checkout. See our Client Session guide on how to create a client session and retrieve a clientToken first.

Environment Requirements

Before diving into the implementation, ensure your environment meets these requirements:
RequirementDetails
Node.jsCurrent LTS version recommended
BrowsersModern browsers with ES2020 support (see below)
Not SupportedInternet Explorer 11, Classic Edge (legacy)

Minimum Browser Versions

The SDK requires ES2020 support. Minimum supported browser versions:
BrowserMinimum Version
Chrome80+
Edge80+
Firefox79+
Safari14+
iOS Safari14+
Opera67+
Samsung Internet13.0+
Legacy browsers like Internet Explorer 11 aren’t officially supported due to their non-standard DOM behavior and lack of support for modern Web Component features and ES2020 syntax that this SDK is built on.

Install the SDK

Install the Primer SDK using your preferred package manager:
npm install @primer-io/primer-js

Load and initialize

Import and initialize Primer in your application:
import { loadPrimer } from '@primer-io/primer-js';
loadPrimer();

Add the checkout component

Create a basic checkout by adding the primer-checkout component to your page:
<primer-checkout client-token="your-client-token"></primer-checkout>
PropertyDescription
client-tokenA token retrieved from the Client Session endpoint. Authenticates the checkout session and contains configuration for available payment methods.

Verify installation

Check that components are registered correctly in your browser console:
console.log(customElements.get('primer-checkout'));

Framework-specific setup

FrameworkAdditional Steps
React 18/19See React Integration Guide for stable reference patterns
Next.jsSee SSR Guide for client-side loading
Nuxt.jsSee SSR Guide for onMounted pattern
SvelteKitSee SSR Guide for onMount pattern
Vue.js (client-only)No additional setup needed
Vanilla JSNo additional setup needed
Server-Side RenderingIf you’re using Next.js, Nuxt, SvelteKit, or any SSR framework, you must load Primer only on the client side. The Web Components API doesn’t exist in Node.js.
useEffect(() => {
  if (typeof window !== 'undefined') {
    loadPrimer();
  }
}, []);
See the SSR Guide for complete patterns.

See also

First Payment

Accept your first payment

Styling

Customize the appearance

Layout

Control component arrangement

Core Concepts

Understand the architecture