はじめに

The Earning Rules API allows you to manage earning rules for your loyalty program. Earning rules define how customers earn points through various activities, such as making purchases or registering for events.

With the Earning Rules API, you can:

To learn more about earning rules, see Managing Your Loyalty Program.

Before you begin

It's important to note the following points before starting to code:

  • The API supports both automated and non-automated earning rules.
  • You must have the Wix Loyalty Program app installed on your site to use this API.

Types of Earning Rules

The Wix Loyalty program supports two types of earning rules:

  1. Automated earning rules
  2. Non-automated earning rules

Both types allow customers to earn points for various actions, but differ in their creation, management, and customization options.

Automated Earning Rules

Automated earning rules are enabled by Wix Automations. There are two subtypes:

  1. Pre-installed earning rules
  2. Custom earning rules

Pre-installed Rules

Pre-installed rules appear automatically when certain business solutions are installed. These rules can be disabled but not deleted.

Earning Rule NameActivity TypeSupported Types
Order a plan (Wix Pricing Plans)wix_pricing_plans-plan_purchasedFixed amount, Conversion rate
Place a restaurant order (Legacy Wix Restaurants)wix_restaurants_orders-order_submittedConversion rate only
Place a restaurant order (New Wix Restaurants)restaurants-order-is-pendingConversion rate only

Custom Rules

Custom rules are created by users and don't come pre-installed. All automated earning rules not listed above fall into this category.

Non-Automated Earning Rules

Non-automated earning rules can be created based on installed Wix business solutions. These rules are identified by their sourceAppId, which differs from automated earning rule sourceAppId.

Supported non-automated earning rules:

Earning Rule NameActivity TypeSupported Types
Purchase a product (Wix Stores)stores/OrderPaidFixed amount, Conversion rate
Book a session (Wix Bookings)bookings/BookingConfirmedFixed amount only
Buy a ticket (Wix Events)events/OrderConfirmedFixed amount, Conversion rate
RSVP to an event (Wix Events)events/RsvpNot specified

For example, if you have Wix Events installed, you can create an earning rule that is triggered when a customer buys a ticket or RSVPs to an event.

Points Calculation

Earning rules can award points in two ways:

  1. Fixed Amount: A set number of points is awarded for a specific action. For example, a customer might receive 10 points for purchasing a ticket through Wix Events.

  2. Conversion Rate: Points are awarded based on a ratio of money spent to points earned. For example, a customer might receive 10 points for every $1 spent. The formula is: (amount spent) / (moneyAmount * points).

Terminology

  • Earning Rule: A condition that, when met, awards loyalty points to a customer. All earning rules allow customers to earn points for performing certain actions, without a minimum spending requirement.
  • Non-Automated Earning Rule: An earning rule set up for specific business solutions, identified by its sourceAppId.
  • Automated Earning Rule: An earning rule enabled by Wix Automations, which can be pre-installed or custom:
    • Pre-Installed: An automated earning rule that comes by default with certain services, which can be disabled but not deleted.
    • Custom: An automated earning rule created by the site owner, not pre-installed by default.
  • Fixed Amount: An earning rule type where a set number of points is awarded for a specific action. For example, a customer might receive 10 points for purchasing a ticket through Wix Events.
  • Conversion Rate: An earning rule type where points are awarded based on a ratio of money spent to points earned. The formula is: [amount spent] / moneyAmount * points.
  • Trigger App ID: The ID of the app that initiates the point assignment. For example: Stores, Bookings, Events.
  • Trigger Activity Type: The specific action that triggers point assignment. For example: "auth/register", "events/OrderConfirmed".
  • Source App ID: The ID of the app managing the rule, which can be either the Loyalty app ID or an Automations app ID.
  • Tier: A tier is a loyalty level that customers are assigned to based on the amount of points they earn. Customers in different tiers may earn points at different rates for the same activity. For example, a higher tier member might earn more points per purchase than a lower tier member.
  • ステータス: The current state of an earning rule (for example, ACTIVE, PAUSED).
役に立ちましたか?
はい
いいえ