getShopRewards

Retrieve all of the rewards for the points program

RivoJS.getShopRewards().then(function(resp){
  console.log(resp)
});

Optional Parameters

ParameterTypeDefaultDescription
opts.pageNumberN/AThe page of results to retrieve. If your shop has many rewards, the results may be paginated.
opts.perPageNumberAuto-calculated*The number of rewards to return per page. Must be between 25 and 1000. *If not specified, defaults to the number of configured points rewards plus 5.
opts.productIdStringN/AFilter rewards to only return those associated with a specific Shopify product ID. When provided, only rewards matching this product ID will be returned. Rewards with no associated product will be excluded.

Notes:

  • Only enabled rewards are returned. Disabled, deleted, or POS-only rewards are excluded automatically.
  • Rewards are ordered by points_amount in ascending order.

Examples:

With pagination:

var opts = {
  page: 2,
  perPage: 50
};

RivoJS.getShopRewards(opts).then(function(resp){
  console.log(resp);
});

Filtered by Product ID:

var opts = {
  productId: "123456789" // Shopify product ID
};

RivoJS.getShopRewards(opts).then(function(resp){
  console.log(resp.rewards); // Returns only rewards associated with this product
});

Sample response

{
    "success": true,
    "rewards": [
        {
            "id": 54321,
            "name": "$5 off coupon",
            "enabled": true,
            "points_amount": 500,
            "points_type": "fixed",
            "reward_type": "fixed_amount",
            "source": "points",
            "pretty_display_rewards": "$5 off coupon (500 points required)",
            "icon_url": null,
            "terms_of_service": {
                "reward_type": "fixed_amount",
                "applies_to": "entire",
                "expiry_months": 2,
                "show_tos": true
            }
        },
        {
            "id": 654321,
            "name": "$10 off coupon",
            "enabled": true,
            "points_amount": 1000,
            "points_type": "fixed",
            "reward_type": "fixed_amount",
            "source": "points",
            "pretty_display_rewards": "$10 off coupon (1000 points required)",
            "icon_url": null,
            "terms_of_service": {
                "reward_type": "fixed_amount",
                "applies_to": "entire",
                "expiry_months": 1,
                "show_tos": true
            }
        },
        {
            "id": 765432,
            "name": "$20 off coupon",
            "enabled": true,
            "points_amount": 2000,
            "points_type": "fixed",
            "reward_type": "fixed_amount",
            "source": "points",
            "pretty_display_rewards": "$20 off coupon (2000 points required)",
            "icon_url": null,
            "terms_of_service": {
                "reward_type": "fixed_amount",
                "applies_to": "entire",
                "show_tos": false
            }
        }
    ]
}