> ## 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.

# Purchase a points product

> `Smile.purchasePointsProduct(id, options?)`

> [!CAUTION]
>
> This method has been removed. Specify `includeSdk: true` when [initializing Smile UI](https://dev.smile.io/ui/initializing.md), and then use the [`Smile.pointsProducts.purchase()`](https://dev.smile.io/js/resources/points-products/purchase) method from the JavaScript SDK instead.

This method exchanges the currently logged-in customer's points for a specified reward.

## Parameters

**id** `integer` *required*

The unique identifier of the points product to be purchased.

**options** `object`

**properties**

**points\_to\_spend** `integer`

A positive integer representing the number of points that will be spent on behalf of the customer. Only applies when purchasing a points product whose `exchange_type` is variable, otherwise should be left blank.

## Returns

This method returns a `Promise` that:

* On success, resolves with a [points purchase](https://dev.smile.io/ui/objects/points-purchase.md) 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.

```javascript JavaScript lines theme={null}
// Purchase a fixed points product
Smile.purchasePointsProduct(132456921).then(
  (pointsPurchase) => {
    // Handle the points purchase object
  }
);

// Purchase a variable points product
Smile.purchasePointsProduct(
  132456921,
  { pointsToSpend: 500 }
).then((pointsPurchase) => {
  // Handle the points purchase object
});
```
