Skip to main content
JavaScript
// If the script is loaded synchronously
SmileUI.initialize({
  publishableKey: "pub_0987654321",
  customerToken:
    "eyJhbGciOiJIUzI1NiJ9.eyJjdXN0b21lcl9pZGVudGl0eSI6eyJkaXN0aW5jdF9pZCI6IjEwMCJ9LCJleHAiOjE1ODU1OTE1MzZ9.PGJhiM0NYRok5VGAlAOT6F-57gu7SCBaennQbt6YrqU",
});

// If the script is loaded asynchronously
document.addEventListener("smile-ui-loaded", () => {
  SmileUI.initialize({
    publishableKey: "pub_0987654321",
    customerToken:
      "eyJhbGciOiJIUzI1NiJ9.eyJjdXN0b21lcl9pZGVudGl0eSI6eyJkaXN0aW5jdF9pZCI6IjEwMCJ9LCJleHAiOjE1ODU1OTE1MzZ9.PGJhiM0NYRok5VGAlAOT6F-57gu7SCBaennQbt6YrqU",
  });
});

Documentation Index

Fetch the complete documentation index at: https://dev.smile.io/llms.txt

Use this file to discover all available pages before exploring further.

This method initializes Smile UI with information about the loyalty program to display and the currently logged in customer. This method must be called before you can interact with any other methods.
If you’re loading the Smile UI script asynchronously, you should wrap your initialization code within a loaded event to ensure it doesn’t encounter an error due to the script not yet being present on the page.

Parameters

options
object
required