Overview
As a partner, you integrate with mgPass Rewards by publishing events when users take actions on your platform. The rewards engine matches events to rules, calculates points, and credits them to the user’s balance.Onboarding
- MG Digital creates your partner account in the admin console
- You receive an API key and a list of allowed event types
- You map your user accounts to mgPass user IDs (via email or the mgPass OAuth flow)
- You start publishing events
Publishing Events
Basic Event
Event with Metadata
Include metadata for per-unit calculations or audit trails:The
reference_id in metadata serves as an idempotency key. Publishing the same reference_id twice will not double-award points.Event Types
Event types are strings that you define with MG Digital during onboarding. Common patterns:| Event Type | Description | Typical Points |
|---|---|---|
article_read | User read an article | 5 per read |
video_watched | User completed a video | 10 per video |
purchase | User made a purchase | 1 per GHS spent |
signup | User registered on your platform | 50 (one-time) |
referral | User referred someone | 100 (one-time) |
daily_login | User logged in today | 5 per day |
share | User shared content | 10 per share |
403.
Points Calculation
Points are calculated using this formula:Example: Per-Unit Rule
If the rule forpurchase is “1 point per GHS spent” and the user is Silver tier (1.5x):
Caps and Frequency
Rules can have daily and monthly caps to prevent abuse:| Cap Type | Description |
|---|---|
daily_cap | Maximum points from this event type per user per day |
monthly_cap | Maximum points from this event type per user per month |
frequency | How often the event can be counted: once, daily, weekly, monthly, unlimited |
points_awarded will be 0 or reduced.
Response Handling
Success
No Matching Rule
Events with no matching rule are still accepted and logged. Points awarded will be 0. This allows you to start publishing events before rules are configured.
Errors
| Status | Error | Description |
|---|---|---|
| 400 | invalid_request | Missing user_id or event_type |
| 401 | unauthorized | Invalid or missing API key |
| 403 | forbidden | Event type not in your allowed list |
| 429 | rate_limit_exceeded | Too many requests (30/min) |
Code Examples
Webhooks
You can receive notifications when points-related events occur. See the Webhooks guide for setup details.Single Sign-On for Your Users
If your users also have mgPass accounts, you can offer seamless SSO using the One Tap SDK. When a user visits your site while logged into mgPass, the SDK shows a “Continue as [Name]” banner that lets them sign in with a single click — no passwords, no redirects.One Tap SDK Guide
Full integration guide for the One Tap SDK. One script tag, one function call.
SSO Architecture
How mgPass SSO works across same-domain and cross-domain applications.

