Rules Engine

Show the right paywall to the right user

PayGate's rules engine evaluates user context in real-time and returns the optimal paywall configuration. Rules are priority-ordered with first-match-wins semantics — no ambiguity, no conflicts.

Target by platform, app version, locale, user segment, existing entitlements, promo links, or percentage-based rollouts. Combine conditions with AND logic for precise targeting.

// 8 built-in condition evaluators

platform        = "ios"
app_version    >= "3.0"
locale         in ["en_US", "en_GB"]
segment        = "power_users"
entitlement    != "premium"
random_percent < 50
custom         = "any_value"

// First matching rule wins
// Priority: 1 (highest) → N (lowest)
A/B Testing

Data-driven paywall optimization

Every paywall can have multiple variants with configurable weights. Users are deterministically assigned using sticky bucketing — they always see the same variant across sessions.

The built-in analytics engine tracks impressions, taps, purchase starts, and completions per variant. Statistical significance is calculated using a two-proportion z-test with automatic sample size checks.

// Variant assignment is deterministic
hash(user_id + paywall_id) % 100

control     weight: 50   conv: 3.2%
variant_a   weight: 25   conv: 4.7%
variant_b   weight: 25   conv: 3.9%

// Statistical significance
z = 2.41, p = 0.016
✔ Significant (p < 0.05)
Purchase Validation

Server-side receipt verification you can trust

Validate purchases server-side with Apple StoreKit 2 JWS verification and Google Play Developer API v3. No client-side trust assumptions — the server is the source of truth.

Automatic entitlement granting on valid purchases. Webhook handlers process subscription renewals, cancellations, refunds, billing retries, and grace periods in real-time.

// Apple StoreKit 2
verifyJWS(signedTransaction)
  // x5c certificate chain → Apple Root CA
  // ES256 signature verification
  // Bundle ID + environment validation

// Google Play Billing v3
getSubscription(purchaseToken)
  // Service account JWT auth
  // Subscription state validation
  // Auto-acknowledge within 3 days
Entitlements

One API for "does this user have access?"

Entitlements are resolved from multiple sources: validated purchases, promo code redemptions, and admin grants. The resolution algorithm handles stacking automatically.

Permanent entitlements always win. For time-limited entitlements, the longest expiry across all sources is used. Source tracking lets you audit exactly where each entitlement came from.

GET /api/v1/entitlements/{user_id}

// Resolution algorithm
1. Collect all user_entitlements
2. Group by entitlement_key
3. If any is_permanent → active forever
4. Else MAX(expires_at) across sources
5. Track winning source

// Sources: purchase, promo, admin_grant
Store Sync

Manage IAPs from one place

Bi-directional sync with App Store Connect and Google Play Developer Console. Import your existing product catalog or push new products directly from PayGate.

Subscription groups, base plans, pricing tiers, and availability — all managed through the admin portal with real-time sync status tracking and error logs.

// Pull: import from stores
POST /sync/apple/pull
  Created: 12, Updated: 3

// Push: create in stores
POST /sync/google/push
  Created: 8, Activated: 8

// Status tracking
synced   pending   error   manual
Admin Portal

Everything at your fingertips

A full-featured web dashboard for managing your entire billing stack. No CLI required.

📦

Product Catalog

Product groups, products, store product mappings, entitlement definitions. Complete CRUD with sync status indicators.

🎨

Paywall Builder

Create paywalls with offerings and A/B test variants. Configure weights, manage templates, preview on device.

📈

Live Analytics

Conversion funnels, variant performance, statistical significance. Know what's working before you commit.

🎫

Promo Codes

Create, distribute, and track promotional codes. Usage limits, expiration dates, and real-time redemption tracking.

🔍

User Lookup

Search any user by ID. View their entitlements, purchases, and subscription history. Grant or revoke access instantly.

🔄

Store Sync

Pull products from App Store and Google Play. Push new IAPs directly. Full sync log with error tracking.

See it in action

Spin up a local instance in minutes, or try the managed cloud for free.

Read the Docs View Pricing