Skip to content

Express Docs v0.1.0


Express Docs / default

Variable: default

const default: object

Defined in: src/index.ts:107

Type Declaration

__diagnostics

__diagnostics: () => DiagnosticsInfo

Returns build-time diagnostics. Safe to call at any time — never throws, never exposes secret values (only key names, not values).

Returns

DiagnosticsInfo

ExpressButtons

ExpressButtons: (config) => ExpressButtonsInstance

Creates an ExpressButtonsInstance that manages one or more express checkout button providers.

The returned instance is inert until render() is called. Provider SDK loading, telemetry initialization, and button rendering all happen lazily inside render().

Parameters

config

ExpressButtonsConfig

The full configuration object describing which providers to render and the callback handlers (onClick, onCancel, onError).

Returns

ExpressButtonsInstance

An ExpressButtonsInstance with render(), teardown(), and teardownProvider() methods.

Example

ts
const buttons = CollanaPay.ExpressButtons({
  providers: [
    {
      providerProtocolType: 'PayPal',
      paymentMethodType: 'PayPalExpress',
      container: '#paypal-btn',
    },
  ],
  onClick: async (identity) => {
    const resp = await fetch('/api/orders', { method: 'POST' });
    const data = await resp.json();
    return data.checkoutData; // base64-encoded string from backend
  },
  onCancel: (identity) => { console.log('Cancelled', identity.paymentMethodType); },
  onError: (error) => { console.error(error.code, error.message); },
});
await buttons.render();

CollanaPay SDK Documentation