Skip to main content
JavaScript
Smile.purchasePointsProduct(132456921).then((pointsPurchase) => {
  // Handle the points purchase object
});

Smile.purchasePointsProduct(132456921, { points_to_spend: 500 }).then(
  (pointsPurchase) => {
    // Handle the points purchase object
  }
);
This method exchanges the currently logged-in customer’s points for a specified reward.

Parameters

id
number
required
The unique identifier of the points product to be purchased.
options
number
required
Required if the points product being purchased has a variable exchange type. In that case, the options object must contain a points_to_spend attribute whose value is the number of points that the customer is spending on the points product.

Returns

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