Loyalty

A loyalty program
in Medusa

Points for every order, right where the store is run: one point per unit of the order total, a reward ladder the customer redeems from, the redemption history and manual adjustments in the admin, and the customer's own points in the storefront. A wholesaler keeps its customers close: every order earns, every reward brings them back.

See it in the demo admin
Loyalty: The integration page in the Medusa admin, demo mode with sample data.
The integration page in the Medusa admin, demo mode with sample data.

What exactly
this integration does

  • Points per order

    A placed order awards the total times pointsPerPln, scaled by the customer's tier multiplier. Idempotent per order; marketplace imports are skipped.

  • A reward ladder

    The rewards from the options, from the cheapest. The admin and the storefront show which reward the customer can redeem next, so the goal is visible.

  • Redemption

    The customer redeems points for a reward or a discount at redeemRate; the redemption is recorded in the ledger and the account's history, once.

  • Manual adjustments

    Bonuses and corrections from the admin, always with a reason and a customer search. The ledger stays complete even when points arrive by hand.

  • The customer's points in the store

    The balance, the totals, the saved amount, the redeemed rewards and the latest transactions through the store API – the customer sees their account without logging into the admin.

  • The original tables untouched

    loyalty_account and loyalty_transaction keep their names and shapes, so stores that ran the original module carry their rows over; the migration only adds the demo flag.

How it guards
your data

  • Points exactly once

    Awarding is idempotent per order: a repeated event never adds points a second time.

  • A closed ledger

    Every transaction has a reason: an order, a redemption or an adjustment with a note. The balance can always be rebuilt from the ledger.

  • Demo kept apart

    Sample accounts and transactions are flagged demo, so showcase data never mixes with real customer points.

Setup
in three steps

The full list of options, events and API routes is in the package README on GitHub.

Paste it into Claude Code, Cursor or another AI assistant in your Medusa project: it installs and configures the integration, with writes off.

  1. 1
    Install the package from npm.
    npm install @koda-plus/medusa-plugin-loyalty
  2. 2
    Add the plugin to medusa-config.ts.
                            plugins: [
      {
        resolve: "@koda-plus/medusa-plugin-loyalty",
        options: {
          // Everything is optional.
          pointsPerPln: 1,
          redeemRate: 0.05,
          rewards: [
            { at: 1500, name: { en: "50 off", pl: "Rabat 50 zł" } },
            { at: 3000, name: { en: "Free 18V drill", pl: "Wkrętarka 18V gratis" } },
          ],
          // demo: process.env.LOYALTY_DEMO === "true",
        },
      },
    ]
                          
  3. 3
    Run the migrations and open the integration in the Medusa admin.
    npx medusa db:migrate

Running for our clients

See our portfolio
  • soon
  • soon
Free 15-minute call

Tell us about your project,
we'll tailor the rest to you

A 15-minute call is enough for us to know whether we are a fit for your project.
We start from what you need, not from an off-the-shelf solution.

See our demo

Contact us

Remigiusz in a navy shirt and glasses
I use iMessage I use WhatsApp
Adrian in a grey turtleneck and glasses
I use iMessage I use WhatsApp