33. Merchant refers merchant: referral codes and free months for both (owner setup + how merchants use it)

(The feature is off until you switch it on in the admin pages. Screenshot places are marked "[screenshot]"; they will be added later.)

What it is

Every member automatically has a short 6-character merchant referral code (a different thing from a promoter's link). A new member can enter a friend's code once, within a limited time after signing up (default 48 hours). When it is accepted, the referrer gets X free months and the new member gets Y free months (you set X and Y; default 1 each). The months are given as a grant licence key in the person's account (shown on the website "Account" page, put on a store like any key). Nothing is charged and Stripe is not involved.

Step 1 - switch it on and set it in the admin pages

  1. Sign in to the admin pages and open 商家推荐 (Merchant referral) in the menu. [screenshot]
  2. Tick 开启商家推荐 and set: the hours after sign-up in which a code can be entered (default 48); the months for the referrer and for the new member (0 = nothing); the most months one referrer can collect (default 12, 0 = no limit; past it the referrer gets nothing more and the new member still gets his months); the plan the months are given as (only "grant" plans).
  3. Save. Switching it off stops new codes and new rewards; free months already given stay.
  4. The page lists every referral (who referred whom, the months) and an event list with the reasons for refusals.

Step 2 - how merchants use it

  • Website: after signing in, Account -> "Invite a merchant and get free months" (it appears only while the feature is on). It shows the member's own code (copy button), the reward, the numbers, and, for a new member, the box for a friend's code. [screenshot]
  • Plugins (GetDropFlow, Social): the License card has a Referral code (optional) box. The plugin sends the code and the licence key to the licence server, which decides; the answer is shown as a fixed sentence. [screenshot]
  • Personalizer and the browser extension: the server routes are ready, the boxes come later. Shopify: design note only (docs/design/merchant-referral-shopify.md).

The rules (read them)

  1. Once only, and inside the hours after sign-up. A merchant can be referred once and the reward is paid once.
  2. Does not count: yourself (same mailbox, including +tags and Gmail dots), the same company e-mail domain (shared providers such as gmail excluded), the same store domain, the same Stripe customer or payment card, the same network, a circle (A refers B and B refers A). The merchant is only told "this code cannot be used for your account"; the real reason is in the admin event list.
  3. It excludes the promoter link: the two features cannot be enjoyed together. A new member either comes through a promoter's link (the promoter earns the commission) or uses a merchant referral code (both get free months). Whichever came first stays; the other never applies.
    • A member already tied to a promoter who enters a code is refused, with the reason explained;
    • a member who used a code is never credited to a promoter later (no commission, no tie at sign-up);
    • commissions already booked are not changed.

One promoter's own rate and period (Affiliate admin)

For a big influencer: open 推广分成 -> the promoter, section 单独比例和期限(覆盖等级). Fill first payment, each renewal (percent or fixed), months of commission, and validity from sign-up. Empty = the promoter's level value (then the plan / plugin / shop rows). Example: 25 % first and renewal, 48 months validity. A set rate replaces the level for every plan that takes part, never stacked; it applies to later payments and later sign-ups; booked commissions and members already referred keep what they had. To remove it, empty all fields and save.

Deploy and rollback

No migration step (the new tables and the column are created at start). Off by default. Rollback: the old code ignores the tables and the column.