Skip to main content
JavaScript
Smile.fetchCustomer().then((customer) => {
  // Handle the customer object
});

Smile.fetchCustomer({ include: "vip_tier" }).then((customer) => {
  console.log(customer.vip_tier.name);
});
This method fetches the latest information for the currently logged-in customer. It is useful when it’s expected that the customer information has changed since the page loaded. A common example of this is right after a customer has spent points, since their points balance will have been updated in Smile. Reloading the customer object allows you to immediately render the customer’s new points balance.

Parameters

options
object
An optional object with one or multiple of the following keys:
  • include - A comma-separated list of related objects to include in the response. The only permitted value is: vip_tier

Returns

This method returns a Promise that:
  • On success, resolves with a customer object.
  • On failure, resolves with an error object.
If the method is improperly invoked (e.g. invalid parameters) or no customer is currently logged-in, the Promise will be rejected.