DRUO
Get started
Components

Mount options & appearance

Every mount option, theming tokens, secure fields and locales.

OptionTypeDefaultNotes
publishableKeystringdata-keyPublic, origin-restricted.
componentIdstring—Identifies the configured component (layout, theme, copy, reward).
intentpayment | buy_now | subscription | connectpaymentDrives copy, gating and the intent record.
modeinline | buttoninlineInline embed or a single button.
completioncomponent | merchantcomponentInline mode: who owns the action button.
presentationmodal | popup | redirectmodalButton mode only: how the experience opens.
authPresentationmodal | popup | redirectmodalInline mode: how bank authentication opens.
amountinteger—Minor units. Required for payment intents.
currencyISO 4217USDFormatting and eligible institutions.
orderIdstring—Echoed back on success.
merchantCustomerRefstringnullSet when the payer is logged in at the merchant. Unlocks merchant-scoped saved accounts.
payerHintstringnullEmail/phone used to look up DRUO network accounts for logged-out payers.
allowSaveAccountbooleantrueShows "save this account for future purchases here".
saveAccountDefaultbooleanfalsePre-checks that box.
payloadHashstringnullHMAC of the payload when tamper protection is ON.
returnUrlstringcurrent URLRedirect presentation only.
buttonLabelstringautoButton mode label override.
localeBCP-47device localeAny locale is served; missing strings are translated on first load and cached.
appearanceobjectcomponent configAppearance API — theme preset, variables, rules. Direct equivalent of Stripe's appearance.
themeobjectcomponent configLegacy shorthand object (accent, radius, fontFamily, …). Still supported; appearance wins.
secureFieldsbooleanfalseRenders the institution fields inside a DRUO-hosted iframe; merchant JS never touches the values.
authMethodsstring[]backend-chosenOptional preference hint; the backend still decides what this account allows.

Appearance API

DRUO's appearance option mirrors Stripe Elements' appearance API one-for-one: a base theme preset, a set of variables (design tokens), and rules (per-element CSS). Everything is scoped to the mounted instance, so two components on the same page can look completely different.

javascript
Druo.mount("#druo", {
  publishableKey: "pk_test_…",
  appearance: {
    theme: "flat",                               // default | flat | minimal | night
    variables: {
      colorPrimary: "#0f9d76",
      colorBackground: "#ffffff",
      colorText: "#101828",
      colorDanger: "#d92d20",
      fontFamily: "Inter, system-ui, sans-serif",
      borderRadius: "14px",
    },
    rules: {
      ".Input": { borderWidth: "2px", padding: "13px 14px" },
      ".Input--invalid": { boxShadow: "0 0 0 3px rgba(217,45,32,.12)" },
      ".Label": { textTransform: "uppercase", letterSpacing: ".04em" },
      ".Button": { borderRadius: "999px", fontWeight: "700" },
      ".Account--selected": { boxShadow: "0 0 0 3px rgba(15,157,118,.12)" },
    },
  },
});

Presets (appearance.theme)

PresetLook
defaultDRUO's shipped light theme.
flatBorderless, tinted surfaces, tighter radius.
minimalWhite surfaces, hairline borders, 6px radius.
nightDark surfaces with light text.

Variables (appearance.variables) — friendly names mapped to CSS custom properties:

VariableCSS variableApplies to
colorPrimary--druoButtons, selected account, focus ring, links.
colorPrimaryText--druo-fgText on the primary button.
colorBackground--druo-bgCard, inputs, dialog background.
colorSurface--druo-surfaceSubtle fills, hovers, skeletons.
colorText--druo-textPrimary text.
colorTextSecondary--druo-mutedHelper, trust and label text.
colorDanger--druo-dangerErrors, invalid inputs.
colorBorder--druo-borderAll borders and dividers.
colorReward--druo-rewardReward/offer pill.
fontFamily--druo-fontWhole component.
borderRadius--druo-radiusCards and containers.

Any raw --druo-* CSS variable can also be passed verbatim.

Rules (appearance.rules) — stable, semantic selectors (internal class names may change; these will not):

.Block, .Input, .Input--valid, .Input--invalid, .Label, .Help, .Error, .Button, .Button--secondary, .Account, .Account--selected, .Tag, .Reward, .Divider, .Trust, .Dialog.

Rules are emitted as a stylesheet scoped with [data-druo-theme="<instanceId>"]. Resolution order: backend component theme → legacy theme → appearance.

Introspection and live updates

javascript
Druo.appearance.themes;     // ["default","flat","minimal","night"]
Druo.appearance.variables;  // friendly variable names
Druo.appearance.selectors;  // semantic rule selectors

// Re-theme a mounted component (e.g. your dark-mode switch)
const c = Druo.mount("#druo", { /* … */ });
matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (e) =>
  c.update({ appearance: { theme: e.matches ? "night" : "default" } }),
);

Secure fields honour the same appearance object: the values are forwarded to the DRUO-hosted iframe so framed inputs match your page.

Secure fields

By default the account inputs render in the merchant DOM — convenient, but the merchant page can technically read them. With secureFields: true the field group is served from https://js.druo.com inside an iframe: the payer types into DRUO's origin, DRUO tokenizes the values, and only an opaque fieldsToken plus { complete, values: [fieldNames] } cross back over postMessage. The change event still fires so merchant code can gate its own button, and the iframe auto-resizes. Use this whenever the integration must keep bank credentials out of merchant scope.

Locales

Copy resolution order: copy overrides → registered locale → English → key. Register additional languages before mounting:

javascript
Druo.locales.register("fr", { "cta.payment": "Payer {amount} par virement" });
Druo.locales.list(); // ["en","es","pt","fr"]

The reward rate is not a mount option. It lives on the component configuration in DRUO and arrives with Get Component Details; the badge renders only when the backend returns one.