Customizable SDK

Full control over the checkout appearance, layout, and field visibility. Match the SDK to your brand without building a form from scratch.

Overview

The Customizable SDK uses the same reliable checkout logic as the Plug & Play SDK, but gives you complete control over how it looks and behaves. Set mode: 'custom' to unlock theme configuration, layout options, field visibility controls, and pre-filled customer data.

Everything from the Plug & Play SDK -- card brand detection, CEP auto-fill, inline validation, 3DS handling, PIX QR code -- is still included in custom mode.
Make sure you have the SDK loaded on your page before using the examples below. See Getting Started — Install the SDK for the CDN script tag or npm installation.

Theme Configuration

Pass a theme object to override the default CSS variables. Every visual aspect of the checkout can be controlled through these variables.

typescript
GlinCheckout.mount('#checkout', {
  publicKey: 'YOUR_PUBLIC_KEY',
  remittanceId: 'REMITTANCE_ID',
  mode: 'custom',
  theme: {
    primaryColor: '#059669',
    primaryColorLight: '#10B981',
    bgColor: '#0F0F0F',
    textColor: '#F9FAFB',
    borderColor: '#2D2D2D',
    inputBorderColor: '#1F3D2E',
    sectionTitleColor: '#34D399',
    borderRadius: '12px',
  },
  onPaymentReady: async ({ remittanceId, paymentData }) => {
    const res = await fetch('/api/confirm-payment', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ remittanceId, paymentData }),
    });
    return res.json();
  },
});

Theme Variables

Name Type Required Description
primaryColorstring—Main accent color for buttons, focus rings, and active elements.
primaryColorLightstring—Lighter variant of the primary color, used for hover states and highlights.
bgColorstring—Background color of the checkout container.
textColorstring—Primary text color for labels, values, and headings.
textSecondaryColorstring—Secondary text color for hints and placeholder text.
borderColorstring—Border color for dividers and section borders.
errorColorstring—Color for validation error messages and error state borders.
successColorstring—Color for success indicators and confirmed states.
inputBgColorstring—Background color for input fields.
inputBorderColorstring—Border color for input fields.
sectionTitleColorstring—Color for section headings (e.g. "Dados pessoais", "Pagamento"). Defaults to textColor.
borderRadiusstring—Border radius for inputs and buttons (e.g. "8px", "0.5rem").
fontFamilystring—Font family stack for all checkout text (e.g. "'Inter', sans-serif").
fontSizestring—Tamanho base da fonte (padrao: "14px").
fontSizeSmallstring—Tamanho de fonte pequeno para dicas e mensagens de erro (padrao: "12px").
fontSizeLargestring—Tamanho de fonte grande para titulos e valores (padrao: "18px").
labelFontSizestring—Tamanho da fonte dos labels do formulario (padrao: "14px").
formMaxWidthstring—Largura maxima do formulario de checkout (padrao: "480px").
summaryMaxWidthstring—Largura maxima do painel de resumo (padrao: "520px").
summaryMinWidthstring—Largura minima do painel de resumo (padrao: "300px").

Layout Options

Control how the checkout sections are arranged using the layout option.

Name Type Required Description
verticaldefault—All sections stacked in a single scrollable column. Best for narrow containers and mobile.

For a multi-step wizard experience, use the paginated option instead of layout. This shows one section at a time with next/back navigation and a step indicator.

typescript
GlinCheckout.mount('#checkout', {
  publicKey: 'YOUR_PUBLIC_KEY',
  remittanceId: 'REMITTANCE_ID',
  mode: 'custom',
  paginated: true,
  onPaymentReady: async ({ remittanceId, paymentData }) => {
    const res = await fetch('/api/confirm-payment', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ remittanceId, paymentData }),
    });
    return res.json();
  },
  onSuccess: (data) => console.log('Paid!', data),
});

Summary Position

Control where the remittance summary panel (merchant info, amount breakdown, conversion rate, fees) appears relative to the checkout form.

Name Type Required Description
rightdefault—Summary panel appears to the right of the checkout form. Best for wide containers (desktop). This is the default.
leftstring—Summary panel appears to the left of the checkout form.
topstring—Summary panel appears above the checkout form. Best for narrow containers and mobile layouts.
bottomstring—Summary panel appears below the checkout form.
hiddenstring—Hides the summary panel entirely. Use when you display order details in your own UI.
typescript
GlinCheckout.mount('#checkout', {
  publicKey: 'YOUR_PUBLIC_KEY',
  remittanceId: 'REMITTANCE_ID',
  mode: 'custom',
  summaryPosition: 'left',
  onPaymentReady: async ({ remittanceId, paymentData }) => {
    const res = await fetch('/api/confirm-payment', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ remittanceId, paymentData }),
    });
    return res.json();
  },
  onSuccess: (data) => console.log('Paid!', data),
});

On mobile viewports, the summary panel automatically stacks above the form regardless of this setting.

Language

The SDK renders its own card form, so it carries its own strings, independent of any translation your page already does. Set locale to choose the language of the field labels, the installment options and the card validation messages.

Name Type Required Description
pt-BRdefault—Portuguese (Brazil). Used when no locale is given, so existing integrations are unchanged.
enstring—English. Matches on the language subtag, so en-US and en_GB also resolve here.
typescript
GlinCheckout.mount('#checkout', {
  publicKey: 'YOUR_PUBLIC_KEY',
  remittanceId: 'REMITTANCE_ID',

  // Card form labels, installments and validation messages.
  // Defaults to 'pt-BR' when omitted.
  locale: 'en',

  onPaymentReady: async ({ remittanceId, paymentData }) => {
    const res = await fetch('/api/confirm-payment', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ remittanceId, paymentData }),
    });
    return res.json();
  },
});

Available from SDK 1.1.0. Earlier builds ignored locale and always rendered Portuguese — if you set it previously and saw no effect, that is why. Tags are matched leniently (pt, pt_BR, PT-br all resolve to pt-BR), and a language we do not ship falls back to Portuguese rather than failing.

Field Visibility

Control which fields are shown, hidden, or read-only. Visibility can be set per section (applies to all fields in that section) or per individual field.

Visibility Modes

Name Type Required Description
autodefault—Field is visible and editable. This is the default for all fields.
hiddenstring—Field is completely hidden from the form. If you hide a required field, you must provide its value via the data option.
readOnlystring—Field is visible but not editable. Useful for displaying pre-filled data the customer should see but not change.

Example: Hidden Customer, Partial Address

In this example, the entire customer section is hidden (with values provided via data), and the address section has specific field overrides.

typescript
GlinCheckout.mount('#checkout', {
  publicKey: 'YOUR_PUBLIC_KEY',
  remittanceId: 'REMITTANCE_ID',
  mode: 'custom',
  visibility: {
    customer: 'hidden',
    address: {
      complement: 'hidden',
      neighborhood: 'readOnly',
    },
  },
  data: {
    customer: {
      taxId: '12345678900',
      name: 'John',
      email: 'john@example.com',
      phone: '+5511999999999', // required, E.164
    },
    address: { neighborhood: 'Centro' },
  },
  onPaymentReady: async ({ remittanceId, paymentData }) => {
    const res = await fetch('/api/confirm-payment', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ remittanceId, paymentData }),
    });
    return res.json();
  },
  onSuccess: (data) => console.log('Paid!', data),
});
When you hide required fields (like taxId, name, or email), you must provide their values through the data option. The SDK will validate that all required data is present before allowing payment submission.

Pre-filling Customer Data

Use the data option to pre-fill form fields. This is especially useful when you already have the customer's information from a previous step in your checkout flow.

typescript
GlinCheckout.mount('#checkout', {
  publicKey: 'YOUR_PUBLIC_KEY',
  remittanceId: 'REMITTANCE_ID',
  mode: 'custom',
  data: {
    customer: {
      taxId: '12345678900',
      name: 'Maria Silva',
      email: 'maria@example.com',
      phone: '+5511999999999', // required, E.164
    },
    address: {
      zipCode: '01001000',
      street: 'Praca da Se',
      number: '100',
      neighborhood: 'Centro',
      city: 'Sao Paulo',
      state: 'SP',
    },
  },
  onPaymentReady: async ({ remittanceId, paymentData }) => {
    const res = await fetch('/api/confirm-payment', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ remittanceId, paymentData }),
    });
    return res.json();
  },
  onSuccess: (data) => console.log('Paid!', data),
});

CSS Class Overrides

For advanced styling beyond theme variables, you can target the SDK's CSS classes directly. All SDK elements use the glin- prefix to avoid conflicts with your existing styles.

css
/* Override the submit button */
.glin-btn-primary {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Override input fields */
.glin-input {
  border-width: 2px;
}

/* Override the card form section */
.glin-card-form {
  padding: 1.5rem;
  border: 1px solid var(--glin-border-color);
  border-radius: var(--glin-border-radius);
}
Theme variables take precedence over hardcoded values in the SDK stylesheet. Use CSS overrides only for properties not covered by the theme variables.

Personalizacao de Tamanhos

Alem das cores e fontes, o tema suporta propriedades de dimensionamento que controlam o tamanho da tipografia e a largura dos paineis. Todas as propriedades possuem valores padrao e sao opcionais.

PropriedadePadraoDescricao
fontSize14pxTamanho base da fonte utilizado em todo o checkout.
fontSizeSmall12pxTamanho de fonte menor para dicas, mensagens de erro e textos auxiliares.
fontSizeLarge18pxTamanho de fonte maior para titulos e valores monetarios.
labelFontSize14pxTamanho da fonte dos labels dos campos do formulario.
formMaxWidth480pxLargura maxima do formulario de checkout.
summaryMaxWidth520pxLargura maxima do painel de resumo da remessa.
summaryMinWidth300pxLargura minima do painel de resumo da remessa.
typescript
GlinCheckout.mount('#checkout', {
  publicKey: 'YOUR_PUBLIC_KEY',
  remittanceId: 'REMITTANCE_ID',
  mode: 'custom',
  theme: {
    primaryColor: '#059669',
    fontSize: '16px',
    fontSizeSmall: '13px',
    fontSizeLarge: '20px',
    labelFontSize: '15px',
    formMaxWidth: '520px',
    summaryMaxWidth: '560px',
    summaryMinWidth: '320px',
  },
  onPaymentReady: async ({ remittanceId, paymentData }) => {
    const res = await fetch('/api/confirm-payment', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ remittanceId, paymentData }),
    });
    return res.json();
  },
});

Ajuste formMaxWidth e summaryMaxWidth para controlar a proporcao entre o formulario e o resumo em telas grandes. Em viewports moveis, ambos os paineis ocupam 100% da largura automaticamente.

Interactive Playground

Experiment with all customization options in real time. Adjust the theme, layout, and visibility settings and see the result instantly.

Try the Interactive Playground →