Advanced Usage

The Simpler JavaScript SDK can be instantiated with a more advanced configuration which will override the default values.

Configuration

Options are passed to the checkout() function as object:

Simpler.checkout({
  appId: "00000000-0000-0000-0000-000000000000",
  target: document.getElementById("checkout-form"),
  currency: "EUR",
  locale: "en",
  separator: "marquee",
  source: "checkout_page",
  items: [{
    id: "123",
    quantity: 2,
    attributes: [{
      key: "color",
      value: "blue"
    }]
  }],
  onSuccess(orderId) {
    // redirect user to order success page
    window.location.pathname = "/success?order_id=" + orderId;
  },
});
PropertyAccepted Value(s)Default Value
appIdA valid UUID stringRequired
targetA valid HTML ElementRequired
currencyA valid ISO 4217 currency code (i.e USD)Required
localeen | fr | it | es | elen
separatortop | bottom | marqueenull
sourceproduct_page | cart_page | checkout_page | minicartnull
itemsThis property holds an array of cart items.[]
items[0].idThe product identifier.Required
items[0].quantityThe product's cart quantity.1
items[0].attributesA key-value pair of attribute code and its related value id.[]
onSuccessA callback function which will be invoked once order has been successfully submitted from Simpler to the remote API. This callback provides the orderId.null