getUserRewardsList

Get all the rewards of the connected user.

Description

Get the details of all the rewards of the connected user.

Response

Returns a Promise containing an array of user reward object. Example:

[
  {
    card_code: '{{user card code}}',
    earned_date: '2023-03-21 15:37:22',
    expiration_date: '2024-03-21 15:37:22',
    external_id: '1000519767592',
    program_name: 'PopHat',
    status: 'valid',
    reward_definition: {
      external_id: 'my-special-reward',
      image_url: '{{image_url}}',
      name: 'Special reward',
      description: 'A special reward for a special person.',
      condition: '',
      nqp_value: 100,
      isDisplayed: true,
    },
  },
  {
    card_code: '{{user card code}}',
    earned_date: '2022-03-21 15:36:19',
    expiration_date: '2023-03-21 15:36:19',
    external_id: '1000419165801',
    program_name: 'PopHat',
    status: 'expired',
    reward_definition: {
      external_id: 'my-birthday-reward',
      image_url: '{{image_url}}',
      name: 'Birthday Reward',
      description: '',
      condition: '',
      nqp_value: 0,
      isDisplayed: true,
    },
  },
];

Code example

splioSDK.getUserRewards().then((userRewards) => {
  console.log('Number of rewards obtained since your joining date:', userRewards.length);
});