Giftie
Greeting Card Builder SDK

Methods

Open, preload, close, inspect, update, and destroy a Greeting Card Builder instance.

window.GreetingCardBuilder(config) returns an isolated SDK instance.

const builder = window.GreetingCardBuilder({
  closeOnComplete: true,
})

Instance surface

MemberSignatureBehavior
open(initData?: object) => instanceCreates or reuses the iframe, opens the modal, and queues initialization.
preload(initData?: object) => instanceCreates the iframe and queues initialization without opening the modal.
close(reason?: string) => instanceCloses an open modal. The default reason is 'api'.
updateConfig(nextConfig?: object) => instanceShallow-merges configuration. Rebuilds the iframe when its URL changes.
getConfig() => objectReturns a shallow copy of current configuration.
getIframe() => HTMLIFrameElement | nullReturns the current iframe, if one exists.
isOpen() => booleanReports whether the modal is open.
isLoaded() => booleanReports whether the iframe's browser load event fired.
isReady() => booleanReports whether the trusted builder emitted gm/ready.
destroy() => voidCloses the modal, removes DOM and message listeners, and makes the instance unusable.

Preload before a user action

Preloading can reduce the delay when the shopper opens the card builder.

builder.preload(cardInitData)

openButton.addEventListener('click', () => {
  builder.open()
})

The SDK sends init data only after the iframe reports ready. Calling preload(nextInitData) again queues and sends the newer payload with a new requestId.

Update configuration

builder.updateConfig({
  closeOnBackdrop: true,
  modalPadding: '24px',
  borderRadius: '16px',
})

Modal accessibility and style fields update immediately. A change that alters the iframe URL tears down the old frame; if the modal is open, the SDK creates the replacement frame immediately.

Destroy permanently

Call destroy() during application teardown when the SDK instance will not be used again. Calls to open(), preload(), or updateConfig() after destruction throw an error. Create a new instance if the integration needs to start again.

Copyright © 2026