Loading...
Guides (For Platforms)
Markdown
Checkout SDK

The @shopdiddo/checkout-core package is Diddo's embeddable checkout UI for web applications. It ships a fully-styled \<CheckoutPage\> component with a first-class theming API so your checkout experience matches your brand — no redirect required.

📘

Before using the SDK, you'll need a Customer Session Token (CST) and a cart_id. See Customer Session Token (CST) if you haven't minted one yet. Full component and theme type definitions are available in the API Reference.


📦 Installation

Install the package from GitHub Packages:

bash

Then import the bundled CSS once at your app entry point (e.g. main.tsx or _app.tsx):

typescript

🛒 Using \<CheckoutPage\>

\<CheckoutPage\> is the top-level component. Render it once at a dedicated route — it manages its own internal state.

typescript

Props

PropTypeDefaultDescription
theme`ThemePartialTheme`Default Diddo theme
environment`'development''preview''production'`
apiBaseUrlstringOverride the API base URL directly. Takes precedence over environment.
💬

If you need sibling components to access the theme (e.g. a custom header), wrap your app in \<ThemeProvider\> and omit the theme prop from \<CheckoutPage\> — it will inherit from the provider above it.


🎨 Theming

Creating a theme

Use createTheme to produce a complete, type-safe theme by merging your overrides onto the Diddo defaults:

typescript

Only the fields you provide are overridden — everything else falls back to Diddo's defaults. Use defineTheme for the same type inference without merging (useful for building partial theme fragments):

typescript

Passing the theme

Pass directly to \<CheckoutPage\>:

typescript

Or share it across multiple components with \<ThemeProvider\>:

typescript

Setting applyGlobalStyles applies the theme's pageBackground and fontFamily to \<body\>. Leave it off if your app controls its own body styles.


🎛️ Theme Tokens

All theme tokens map to --dc-* CSS variables on the provider wrapper.

colors

TokenDefaultDescription
brand#6366f1Primary brand accent — used on interactive controls, links, and the submit button gradient start.
brandStrong#4f46e5Stronger brand shade — submit button gradient end.
surface#ffffffCard and sheet background color.
text#1a1a1aDefault body text.
textMuted#64748bSecondary/muted body text.
borderrgba(0,0,0,0.1)Hairline borders.
accentPrimary#1a1a1aPrimary text on receipt and overlays.
accentSecondary#1a1a1aSecondary text (labels, headings on receipt).
accentMuted#888Faded/muted text.
glassBgrgba(0,0,0,0.04)Translucent background behind item images.
confirmedIconColor#1a1a1aCheck icon color in the order-confirmed overlay.

typography

TokenDefaultDescription
fontFamily"Satoshi", system-ui, sans-serifFull font stack. Set this if you're loading a custom font.
letterSpacingnormalGlobal letter-spacing.

layout

TokenDefaultDescription
containerMaxWidth960pxMax width of the main checkout container.
pageBackground#f9fafbPage background (only applied when applyGlobalStyles is set).
scrollbarWidth5pxCustom scrollbar width.
scrollbarThumbrgba(0,0,0,0.12)Scrollbar thumb color.
scrollbarThumbHoverrgba(0,0,0,0.18)Scrollbar thumb hover color.

components

Receipt

TokenDefault
grandTotalFontSize23px
grandTotalFontWeight500
totalsRowFontWeight500
totalsRowOpacity0.5
orderTotalPaddingTop60px
itemNameWhiteSpacepre-wrap

Overlay (order-confirmed screen)

TokenDefault
titleFontSize28px
iconSize80px
iconBackground#00000070

Card button (payment method buttons)

TokenDefault
heightauto
borderRadius8px
outlineColorrgba(0,0,0,0.1)
boxShadownone
boxShadowHovernone
boxShadowActivenone

stripe

Pass a Stripe Appearance object to customise the Stripe-hosted payment iframe. colors.brand is automatically synced to colorPrimary, so the Stripe UI stays in step with your brand color without any extra config:

typescript

animations

ValueBehaviour
'rich' (default)Full motion — transitions, enter/exit animations.
'minimal'Reduced motion. Also forced automatically when the user has prefers-reduced-motion enabled.

assets

TokenDescription
logoReceipt logo — a URL string or bundler-resolved import.
logoAltAlt text for the logo.

👉 Next: Error Handling →