loyalty/redeem/reward

Redeem a reward

Fields

appId • string required

The unique identifier for the store. This value is accessible at the block level via tapcartData?.appId

rewardId • string required

The unique identifier of the reward to be redeemed


Description

Redeems a specified reward for the customer through the enabled loyalty provider.

Example

Tapcart.action("loyalty/rewards", {
  appId: "AbC123XyZ9",
	rewardId: 12345
});

// Alternatively
Tapcart.actions?.redeemLoyaltyReward({ 
  appId: tapcartData?.appId, 	
  rewardId: Number("12345") 
})

Response Structure

The Reward Identity Object represents the information needed to redeem a loyalty reward.

  • If a reward requires additional metadata when being added to the cart, this information will be returned in the cartLineItems.attributes array.
{
  code: string;           // Discount code to redeem
  variantId?: string;     // Variant Id of the product to redeem if available
  cartLineItems?: {
    // metadata required for certain rewards/providers, returned as key-value attributes
    attributes: {
      key: string;         // Attribute key
      value: string;       // Attribute value
    }[];
  };
  createdAt: Date;        // Timestamp when the reward was created
  description?: string;   // Optional description of the reward
  customAttributes?: T;   // Optional raw custom data from the provider API
}
⚠️

Important Notes

  • Upon redeeming a reward or completing a purchase, the customer’s loyalty data is automatically refreshed by invoking loyalty/customer, ensuring their points balance is current and accurate.

Did this page help you?