Style the component
Set the colors, corner radius, font and shadow of the Altruon.js component with styleCustomization when you create the session.
You style the Altruon.js component from your server. Add a styleCustomization object to the Create Session request and the component renders with those styles. There is nothing to configure in the browser.
- Your serverCreate the sessionAdd
styleCustomizationto the request body. - AltruonKeeps the stylesThe styles are stored with the session.
- BrowserRender the component
renderComponent()applies them automatically.
Altruon.js only
styleCustomization styles the embedded component. Hosted pages and dynamic hosted checkout take their appearance from Settings > Checkout in the backoffice.
Style a session
Add styleCustomization to the session
Every property is optional. This example sets two of them. The rest keep their defaults.
body: JSON.stringify({
paymentData: { currency: 'USD' },
redirectUrl: 'https://yourdomain.com/success',
billingData: {
lineItems: [{ type: 'plan', id: process.env.PLAN_ID, quantity: 1 }],
billingPlatformId: process.env.BILLING_PLATFORM_ID,
},
styleCustomization: { accentColor: '#6366F1', borderRadius: '10px' },
}),Render the component as usual
The browser code does not change. The session already has the styles.
altruon.setSession(sessionId);
altruon.renderComponent('#altruon-payment-container');Check the result
Open your checkout page. The annotated example below shows which part of the component each property changes.

Style options lists all nine properties with their types and defaults.
Theme recipes
The merchant demo maps its storefront branding onto the component, so the component looks like part of the host page.
function buildStyleCustomization(branding = {}) {
return {
backgroundColor: '#FFFFFF',
primaryColor: '#E2E8F0', // input borders and dividers inside the component
secondaryColor: '#FFFFFF',
accentColor: branding.primaryColor || '#6366F1', // buttons and focus states
borderRadius: '10px',
headerTextColor: '#0F172A',
textColor: '#0F172A',
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
dropShadow: false,
};
}More complete themes are in Style options.
Different styles per plan
Styles are set per session, so your server can choose them at runtime: by plan, by shopper type or by the page the shopper came from.
const themes = {
basic: { accentColor: '#9CA3AF', borderRadius: '4px', dropShadow: false },
premium: { accentColor: '#60A5FA', borderRadius: '8px', dropShadow: true },
enterprise: { backgroundColor: '#1F2937', textColor: '#F3F4F6', accentColor: '#FBBF24', borderRadius: '12px' },
};
app.post('/create-checkout-session', async (req, res) => {
const styleCustomization = themes[req.body.planType] || themes.basic;
// Send styleCustomization in the Create Session request body.
});Language
The language of the component is also set on the session, with the locale field. See Create a session.
Accessibility and fonts
- Contrast. Keep at least the WCAG AA ratio of 4.5:1 between
textColorandbackgroundColor. Dark text such as#1F2937on#FFFFFFpasses. Light gray text such as#D1D1D1on#EFEFEFdoes not. - Focus states.
accentColormarks the focused field. Choose a value that stays visible againstbackgroundColor. - Font fallbacks. Give
fontFamilya list, not a single font:'"YourBrandFont", Arial, sans-serif'. If the custom font is unavailable, the next one is used. - Custom fonts. Load the font on your page before you render the component.
- System fonts. A system stack such as
system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serifneeds no download and performs best.
Test it
Create one session per theme you want to compare, then check each one:
- Colors match what you set and text is readable.
- The font loads.
- The corner radius applies to all elements, and the shadow shows if you enabled it.
- The component looks right in Chrome, Firefox, Safari and Edge, on iOS and Android, at different screen sizes, and with light and dark system themes.
Troubleshooting
- Check that
styleCustomizationis in the Create Session request body. - Check that the session was created: the response has a
session_id. - Check the property names for typos.
- Check that each color is a valid hex, RGB or named value.
- Make sure the font is loaded on your page before you render the component.
- Add fallback fonts:
fontFamily: '"CustomFont", Arial, sans-serif'. - If it still fails, use a web-safe or system font.
- Check the color format (hex,
rgb()orrgba()). - If you use
rgba(), check the transparency value. - Compare on more than one device and browser.