> ## Documentation Index
> Fetch the complete documentation index at: https://developers.mageloyalty.com/llms.txt
> Use this file to discover all available pages before exploring further.

# getProductBonusCampaign

> Get the active bonus campaign for a product and when it ends.

Returns the bonus campaign running on a product, such as double points this weekend. Returns `null` when the product isn't part of an active campaign.

## Usage

```javascript theme={null}
const resp = await MageSDK.getProductBonusCampaign({ productId: {{ product.id }} });

if (resp.success && resp.data) {
  console.log(resp.data.multiplier); // 2
  console.log(resp.data.endsAt);     // "2026-10-21T03:59:59.000Z"
}
```

### Parameters

<ParamField body="productId" type="number | string" required>
  The product ID.
</ParamField>

### Example

```javascript theme={null}
const resp = await MageSDK.getProductBonusCampaign({ productId });
const campaign = resp.success ? resp.data : null;

if (campaign && campaign.type === 'multiplier') {
  pillEl.textContent = `${campaign.multiplier}× points this weekend`;

  const ends = new Date(campaign.endsAt).toLocaleDateString(undefined, {
    day: 'numeric',
    month: 'short',
    timeZone: 'America/New_York' // your store's timezone
  });
  endsEl.textContent = `Ends ${ends}`;
}
```

`endsAt` is in UTC. Pass your store's timezone when formatting a date, otherwise customers see it in their own timezone.

<Tip>
  To show how much the customer earns with the bonus, use [getProductEarningValue](/js-sdk/product/get-product-earning-value). Only show bonus messaging when its `bonusApplied` is `true`.
</Tip>

## Response

`data` is `null` when no campaign applies to the product.

<ResponseField name="data.type" type="string">
  `"multiplier"` (for example double points) or `"tiered"` (a bonus for spending over an amount).
</ResponseField>

<ResponseField name="data.name" type="string">
  The campaign name.
</ResponseField>

<ResponseField name="data.multiplier" type="number">
  Multiplier campaigns only. For example `2` for double points.
</ResponseField>

<ResponseField name="data.tiers" type="array">
  Tiered campaigns only. Each tier has `spendFormatted` (`"$500.00"`) and `bonusFormatted` (`"$25.00"` or `"500"`), plus the raw numbers `spendThreshold` and `bonusValue`.
</ResponseField>

<ResponseField name="data.endsAt" type="string">
  When the campaign ends, as an ISO 8601 date in UTC.
</ResponseField>

<ResponseField name="data.requiredProducts" type="object | null">
  Set when the campaign only applies if a specific product is in the cart: `{ met, productIds }`, where `met` is `true` once one of `productIds` is in the cart. Otherwise `null`.
</ResponseField>

<ResponseField name="error" type="string">
  Error message when `success` is `false`.
</ResponseField>

<ResponseExample>
  ```json Multiplier theme={null}
  {
    "success": true,
    "data": {
      "type": "multiplier",
      "name": "Double Points Weekend",
      "multiplier": 2,
      "endsAt": "2026-10-21T03:59:59.000Z",
      "requiredProducts": null
    }
  }
  ```

  ```json Tiered (points) theme={null}
  {
    "success": true,
    "data": {
      "type": "tiered",
      "name": "Spend More, Earn More",
      "tiers": [
        { "spendThreshold": 100, "spendFormatted": "$100.00", "bonusValue": 500, "bonusFormatted": "500" },
        { "spendThreshold": 250, "spendFormatted": "$250.00", "bonusValue": 1500, "bonusFormatted": "1,500" }
      ],
      "endsAt": "2026-10-21T03:59:59.000Z",
      "requiredProducts": null
    }
  }
  ```

  ```json Tiered (store credit) theme={null}
  {
    "success": true,
    "data": {
      "type": "tiered",
      "name": "Spend More, Earn More",
      "tiers": [
        { "spendThreshold": 100, "spendFormatted": "$100.00", "bonusValue": 5, "bonusFormatted": "$5.00" },
        { "spendThreshold": 250, "spendFormatted": "$250.00", "bonusValue": 15, "bonusFormatted": "$15.00" }
      ],
      "endsAt": "2026-10-21T03:59:59.000Z",
      "requiredProducts": null
    }
  }
  ```

  ```json No campaign theme={null}
  {
    "success": true,
    "data": null
  }
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.