For Developers

Integration Guide for Online Businesses

Embed loyalty program widgets directly into your website or e-commerce store, and reward customers automatically with the Mmama Perks API.

Getting Started in 4 Steps

From zero to integrated in under an hour.

1

Get Approved for API Access

Log into your Business Dashboard, navigate to the API Access tab, and submit a request describing your integration use case. Our team reviews all requests.

2

Receive Your API Key

Once approved, you'll receive a secret API key (mm_live_...) visible in your dashboard. Keep this key secure — it grants access to your loyalty data.

3

Embed the Widget Script

Add the Mmama Perks widget script to your website's <head> tag, then place the widget container wherever you want the loyalty card to appear.

4

Start Rewarding Customers

Customers can now join your loyalty programs, collect stamps/points, and redeem rewards directly from your website. Award points via the API on every purchase.

Embedding Guide

Choose your integration method below.

Loyalty Card Widget

Shows the customer's stamp card, points balance, and reward progress. Auto-syncs in real-time. Works on Shopify, WooCommerce, WordPress, Wix, and any custom website.

Quick Embed (HTML)

html
<!-- 1. Add to your <head> -->
<script src="https://api.mmamaperks.app/widgets/embed.js"
        data-api-key="mm_live_YOUR_API_KEY"
        data-business-id="YOUR_BUSINESS_ID"
        defer>
</script>

<!-- 2. Place wherever you want the card to appear -->
<div id="mmama-loyalty-card"
     data-program-id="YOUR_PROGRAM_ID"
     data-theme="light"
     data-customer-email="customer@example.com">
</div>

Programmatic Initialisation

javascript
// Or initialise programmatically (recommended for SPAs)
<script>
  window.MmamaPerks.init({
    apiKey: "mm_live_YOUR_API_KEY",
    businessId: "YOUR_BUSINESS_ID",
  });

  // Mount the loyalty card widget
  MmamaPerks.mountCard({
    container: "#loyalty-card",
    programId: "YOUR_PROGRAM_ID",
    customerEmail: "customer@example.com",
    theme: "light",
    onRewardReady: function(card) {
      console.log("Customer earned a reward!", card);
    },
    onStamp: function(newTotal, goal) {
      console.log("Stamp earned: " + newTotal + "/" + goal);
    }
  });
</script>

Security Best Practices

Never expose your API key in client-side code

If you must embed the widget script client-side, use the read-only widget embed — not the full API key. Full API key calls should go through your backend server.

Rotate keys if compromised

If your key leaks, revoke it immediately from your Business Dashboard → API Access tab and request a new one.

Use the correct scopes

Request only the permissions you need (e.g. just 'earn' if you're only awarding points). Minimising scopes reduces risk.

Rate limits apply

Default rate limit is 100 requests/hour per key. Contact us for higher limits on enterprise plans.

Ready to integrate?

Set up your business profile, create a loyalty program, and request API access.