Search.../

updateReward( )

Developer Preview

Updates a loyalty reward.

Description

Use this endpoint to update details of a reward, such as the name, whether or not a reward is active, or the amount of points it costs to redeem. Also use this endpoint to add new tiers that are eligible to redeem a reward.

You may not change the type of a reward. That is set upon creation and cannot be updated.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function updateReward(_id: string, reward: UpdateReward): Promise<UpdateRewardResponse>

updateReward Parameters

NAME
TYPE
DESCRIPTION
_id
string

Reward ID.

reward
UpdateReward

Reward info to update.

Returns

Return Type:

Promise<
UpdateRewardResponse
>
NAME
TYPE
DESCRIPTION
reward
Reward

Updated reward.

Was this helpful?

updateReward example

Copy Code
1import { rewards } from 'wix-loyalty.v2';
2
3 async function updateReward(id, reward) {
4 try {
5 const result = await rewards.updateReward(id, reward);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13