What it does
mam-inapp-purchase-manager is the bridge between Apple App Store / Google Play in-app purchases and WooCommerce. It gives you three things:
- A product model. WooCommerce products gain an “In APP Purchase” checkbox, plus four custom attributes (Duration, Default Product, IAP Discount Label, IAP Subtitle Label) that describe each subscription tier.
- A purchase recorder. When the mobile app reports a successful App Store / Google Play receipt, the plugin creates a
wc-completedWooCommerce order against the buying user, stamped with anexpiration_date. That order is the WordPress-side record of “this user is subscribed until X.” - A subscription gate. The mobile JSON payload gets a set of
inapp_*keys that drive the app’s paywall — whether to show it, what products to display, what colors to use, and where the legal links point.
The plugin is admin-first for everyday work (configure keys, design the paywall, build products) and developer-friendly at the edges (three filter hooks for overriding subscription status, requirement, and active-product resolution).
Where it appears in the app
When the mobile app fetches its configuration, the plugin injects a paywall configuration block. The most relevant flags:
inapp_has_iap— tells the app whether to show the IAP screen at allinapp_is_required— tells the app whether to gate content behind a purchaseiap_co_packages[]— the list of buyable subscription tiers, one entry per IAP-flagged WooCommerce productiap_single_screen— switches the app between the multi-product carousel and the single-screen “feature list + one CTA” presentationiap_off_in_sandbox— disables the paywall in sandbox builds
Administrator users always receive inapp_has_iap = 'no' and inapp_is_required = 'no', so admins testing the app see content as if they were already subscribed. To grant the same exemption to other users, see Recipe: Bypass IAP for a specific user.
Requirements
- WordPress 6.3+
- PHP 8.1+
- WooCommerce (declared as a required plugin via
mam_required_plugins) - MAM Suite with
mam-main1.9.1 or higher - MAM Suite plugin entitlement for
mam-inapp-purchase-manager
If mam-main is older than 1.9.1, the plugin logs an admin alert via mamdebug and continues to load — but expect breakage in the phone-data pipeline until you upgrade.
What gets recorded when a user purchases
The plugin treats App Store / Google Play as the authoritative source of truth. WooCommerce orders are convenience records, not payment records.
When mam_iap_purchase fires (from mam-main’s AJAX pipeline) with a product SKU and expdatestamp from the receipt:
- The plugin resolves the buying user via
mam_update_current_user(so$mam_user_idis set). - It looks up the WooCommerce product by SKU.
- It checks for an existing
wc-completedorder with the sameexpdatestamp+iap_productmeta. If one exists, it skips — receipts are not double-recorded. - It computes an expiration date by reading the product’s
durationattribute (1 Day,1 Month,1 Quarter,1 Year). - It creates a
wc-completedWooCommerce order against the user, sets attribution metadata, and writesiap_expiration_date,iap_product, and (if in the future)expiration_datepost meta.
Security note. The plugin does not call Apple’s
verifyReceiptor Google Play’s billing API. Anything in$_REQUEST['product']and$_REQUEST['expdatestamp']is trusted at face value. Apple and Google remain the source of truth for actual subscription status — a forged WooCommerce order does not unlock anything inside Apple’s or Google’s systems.
Hooks exposed
| Hook | Type | Audience | Purpose |
|---|---|---|---|
mam_iap_purchase |
filter | mam-main / dispatcher | Internal entry point that records a receipt as a WooCommerce order. Called by mam-main’s AJAX pipeline; not typically subscribed to by other plugins. |
mam_iap_active_subscriber_product |
filter | PHP dev | Resolves the SKU of the current user’s active subscription. Subscribe to override (e.g., bundle entitlements, B2B licenses). |
mam_iap_require_iap |
filter | PHP dev | Override the inapp_has_iap / inapp_is_required flags before they go to the mobile client. |
Each hook has its own dedicated article. See Related articles.
Mobile JSON contract
mam-inapp-purchase-manager writes into the mobile JSON payload via mam_get_phone_data_before_send. These keys are part of the frozen mobile contract — renaming any of them will break deployed apps.
| Key | Shape | Notes |
|---|---|---|
inapp_has_iap |
'yes' / 'no' |
Whether to show the IAP screen at all. |
inapp_is_required |
'yes' / 'no' |
Whether to require a purchase to proceed. Forced to 'no' for admins. |
iap_co_packages |
array of product objects | One entry per IAP-flagged WooCommerce product. |
iap_off_in_sandbox |
'yes' / 'no' |
Skip the paywall on sandbox builds. |
iap_single_screen |
'yes' / 'no' |
Use the single-screen UI presentation. |
iap_sub_product |
string | Android product group ID. |
inapp_shared_sec |
string | iOS shared secret. |
inapp_and_key |
string | Android billing key. |
inapp_logo, inapp_logo_aspect |
string | Logo URL and computed aspect ratio. |
inapp_purchase_title |
string | Paywall headline. Defaults to Unlock Premium Features. |
inapp_sub_name, inapp_description |
string | Display copy. |
inapp_ios_terms_of_service, inapp_terms_of_service, inapp_privacy_policy |
URL | Legal links. iOS and Android can have separate ToS URLs. |
iap_text_color_red/green/blue |
string | RGB components (zero values are coerced to 1 for app compatibility). |
iap_background_color_red/green/blue |
string | Same convention. |
inapp_button_background_color_red/green/blue |
string | Same convention. |
inapp_button_title_color_red/green/blue |
string | Same convention. |
iap_fandb_text |
array of strings | Feature/benefit lines on the single-screen UI. |
Each iap_co_packages entry has the shape:
[
'id' => '123', // WC product ID, as string
'name' => 'Premium',
'sku' => 'premium_yearly',
'android_sku' => 'premium-yearly', // underscores → hyphens
'price' => '49.99',
'regular_price' => '49.99',
'sub_amount' => '49.99 per year',
'sub_title' => '$49.99 per year',
'description' => '...',
'imageurl' => 'https://...',
'aspect' => '0.5',
'type' => 'sub', // 'sub' or 'consumable'
'android_type' => 'subs', // 'subs' or 'inapp'
'discount_label' => ' Save 20%',
'iap_subtitle_label'=> 'Best value',
'iap_default' => 'Yes',
'text_align' => 'center',
'use_desc_at_top' => 'yes',
]
Admin surface
The plugin adds Mobile App Mgr → In-App Purchase Manager under the MAM main nav. The page has up to two tabs:
- General — keys, URLs, colors, on/off flags. Always visible.
- Screen Settings — single-screen UI configuration (CTA copy, bullet image, eight feature/benefit lines, purchase button title, promo-code flag). Only visible when
Use single screen IAP UI?isyes.
Saves are nonce-verified (mam_iap_save) and require the manage_options capability.
Common tasks
- Configure App Store / Google Play keys, ToS, and colors → Recipe: Configure IAP settings
- Create a subscription product the app can sell → Recipe: Create an IAP product
- Switch to the single-screen paywall presentation → Recipe: Use the single-screen IAP UI
- Exempt a specific user from the paywall → Recipe: Bypass IAP for a specific user
- Override the active-subscription decision in code → Hook: mam_iap_active_subscriber_product
- Override whether IAP is required in code → Hook: mam_iap_require_iap
- Understand how a receipt becomes a WooCommerce order → Hook: mam_iap_purchase
Verification
This article was last verified against:
- Plugin:
mam-inapp-purchase-managerv2.0 mam-main1.9.1+ (required)- WooCommerce (required)
Re-verify whenever a new hook is added or removed, the keys named under Mobile JSON contract change, the iap_co_packages entry shape changes, or the duration → expiration mapping in add_purchase() is altered.
Related articles
- Recipe: Configure IAP settings
- Recipe: Create an IAP product
- Recipe: Use the single-screen IAP UI
- Recipe: Bypass IAP for a specific user
- Hook: mam_iap_purchase
- Hook: mam_iap_active_subscriber_product
- Hook: mam_iap_require_iap
Metadata
| Field | Value |
|---|---|
| Article type | Plugin Overview |
| Plugin slug | mam-inapp-purchase-manager |
| Applies to plugin version | 2.0+ |
| Category | Plugin Reference |
| Depends on | MAM Main |
| Requires (third-party) | WooCommerce |
| Hooks exposed | mam_iap_purchase, mam_iap_active_subscriber_product, mam_iap_require_iap |
| Last verified | 2026-05-01 |
