Skip to content
CUBELABS
All products

Refera

Referral programmes as a service

In productionVisit the site

Refera is the infrastructure behind a referral programme: who referred what, which sale actually closed, how much each partner is owed and how that money goes out. The company sets the rules; the system applies them.

It is multi-tenant from day one, so an agency or a holding group runs several programmes from one account, with a super-admin who can cross into a client to support them.

Everything the dashboard does is also on the MCP server: 53 tools covering campaigns, plans, targets, sales, ranking and rewards, sellers, commissions, PIX payouts, webhooks, API keys and notifications. An AI agent runs the programme with the same key as the REST API.

In production at EscolaNutri, a school-nutrition SaaS that runs its partner programme on Refera — sales, commissions and seller signup integrated end to end.

The problem

Referral is the cheapest channel a company has and the worst managed. The spreadsheet survives the first month. After that nobody knows who referred what, which sale actually closed or how much is owed — and the partner who was bringing customers stops, because chasing the commission costs more than the commission is worth.

How it works
  1. 01

    The programme

    You create campaigns with plans, targets, ranking and rewards, and set the commission for each plan. Every seller joins the active campaigns automatically.

  2. 02

    Integration

    A checklist walks you through setup and hands you a ready-to-copy integration snippet. The /<company-slug>?ref=<code> link works on any site, including SPAs with hash routes; every click is tracked, and a public endpoint returns the referrer’s name so the signup page can show “referred by so-and-so”. With SSO, the company’s own users become sellers without creating another account.

  3. 03

    Partners and sellers

    Each one logs into their own portal, with a public profile, sales, rewards and payouts. On first access, a guided tour shows where everything is.

  4. 04

    Conversion

    The company reports the sale through the API, a Stripe webhook or by hand. Commission is calculated on the spot, by the plan sold and under the rule that applied at that moment.

  5. 05

    Payout

    Partners request a PIX payout and follow their own statement; the company sees the consolidated view and what is still open.

What is inside
  • Multi-tenant with super-admin
  • Campaigns with plans, targets, ranking and rewards
  • Commission calculated per plan on every sale
  • Referral links for any site, including SPAs
  • Click tracking and “referred by” on signup
  • Seller portal with public profile and guided tour
  • Commissions and PIX payouts
  • Onboarding checklist and integration snippet
  • SSO: company users become sellers without a new signup
  • Public REST API
  • MCP server with 53 tools, using the same API key
  • Per-client Stripe webhook
  • Webhooks with secret rotation and SSRF protection
  • Secrets encrypted at rest (AES-256-GCM)
  • Magic link, password recovery and rate limiting
  • Email and Slack notifications

Built with

  • Next.js
  • React
  • Supabase
  • Drizzle
  • Stripe
  • Resend
  • MCP