Live demo — filling the form submits to POST /api/loyalty/join
Drop this script on any page. The widget renders inline at the injection point.
<div id="my-loyalty-widget"></div>
<script>
// Replace with your widget's actual config URL
(function(w,d,s){
var l = d.createElement(s);
l.src = 'https://apex-covenant-digital-marketing.polsia.app/widgets/loyalty.js';
l.setAttribute('data-target', 'my-loyalty-widget');
d.head.appendChild(l);
})(window,document,'script');
</script>
// Join the loyalty program
POST /api/loyalty/join
Content-Type: application/json
{
"name": "Jane Smith",
"email": "jane@example.com",
"phone": "+15550000000" // optional
}
// → 201 Created
{
"success": true,
"member": {
"id": 42,
"name": "Jane Smith",
"email": "jane@example.com",
"tier": "bronze",
"joinedAt": "2026-06-03T00:00:00.000Z"
}
}
// → 409 Conflict (email already registered)
{
"error": "This email is already registered."
}
// ───────────────────────────────────────
// Key-gated — auth via POLSIA_API_KEY
GET /api/loyalty/members?limit=50&offset=0
Authorization: Bearer <POLSIA_API_KEY>
// → 200 OK
{
"count": 1,
"members": [{
"id": 42,
"name": "Jane Smith",
"email": "jane@example.com",
"phone": "+15550000000",
"tier": "bronze",
"joinedAt": "2026-06-03T00:00:00.000Z"
}]
}
// → 401 Unauthorized
{ "error": "Unauthorized" }