iOS / Swift

Add PayGate to your SwiftUI or UIKit app with Swift Package Manager.

1. Install

// In Xcode: File → Add Package Dependencies // Enter the repository URL: https://github.com/paygate/paygate-ios.git

2. Initialize

import PayGate @main struct MyApp: App { init() { PayGate.configure( apiKey: "your-api-key", userId: currentUserId() ) } }

3. Show a Paywall

let result = try await PayGate.evaluatePaywall( triggerEvent: "main_cta_tapped", context: ["segment": "free_user"] ) if let paywall = result.paywall { PayGatePaywallView(paywall: paywall) .onPurchaseComplete { purchase in print("Purchased: \(purchase.productId)") } }

4. Check Entitlements

let entitlements = try await PayGate.getEntitlements() if entitlements.hasActive("premium") { // Unlock premium features }

Android / Kotlin

Add PayGate to your Compose or View-based Android app.

1. Install

// build.gradle.kts dependencies { implementation("com.paygate:paygate-android:1.0.0") }

2. Initialize

class MyApplication : Application() { override fun onCreate() { super.onCreate() PayGate.configure( context = this, apiKey = "your-api-key", userId = currentUserId() ) } }

3. Show a Paywall

val result = PayGate.evaluatePaywall( triggerEvent = "main_cta_tapped", context = mapOf("segment" to "free_user") ) result.paywall?.let { paywall -> PayGatePaywallActivity.launch( context = this, paywall = paywall, onPurchase = { purchase -> Log.d("PayGate", "Purchased: ${purchase.productId}") } ) }

4. Check Entitlements

val entitlements = PayGate.getEntitlements() if (entitlements.hasActive("premium")) { // Unlock premium features }

.NET MAUI / C#

Cross-platform mobile development with the PayGate MAUI SDK.

1. Install

dotnet add package PayGate.Maui

2. Initialize

public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder(); builder.UsePayGate(options => { options.ApiKey = "your-api-key"; options.BaseUrl = "https://api.cloud.paygate.now"; }); return builder.Build(); }

3. Evaluate & Present

var result = await _payGate.EvaluatePaywallAsync( "main_cta_tapped", new { segment = "free_user" } ); if (result.Paywall is { } paywall) { await _payGate.PresentPaywallAsync(paywall); }

4. Check Entitlements

var entitlements = await _payGate.GetEntitlementsAsync(); if (entitlements.HasActive("premium")) { // Unlock premium features }

Flutter / Dart

Cross-platform Flutter integration with the PayGate plugin.

1. Install

flutter pub add paygate_flutter

2. Initialize

import 'package:paygate_flutter/paygate_flutter.dart'; void main() { PayGate.configure( apiKey: 'your-api-key', userId: currentUserId(), ); runApp(const MyApp()); }

3. Show a Paywall

final result = await PayGate.evaluatePaywall( triggerEvent: 'main_cta_tapped', context: {'segment': 'free_user'}, ); if (result.paywall != null) { await PayGate.presentPaywall( result.paywall!, onPurchase: (purchase) { print('Purchased: ${purchase.productId}'); }, ); }

React Native / TypeScript

React Native integration with hooks and components.

1. Install

npm install @paygate/react-native

2. Initialize

import { PayGateProvider } from '@paygate/react-native'; export default function App() { return ( <PayGateProvider apiKey="your-api-key" userId={currentUserId()}> <MainApp /> </PayGateProvider> ); }

3. Show a Paywall

import { usePaywall, PaywallSheet } from '@paygate/react-native'; function UpgradeScreen() { const { paywall, evaluate } = usePaywall(); useEffect(() => { evaluate('main_cta_tapped', { segment: 'free_user' }); }, []); return paywall ? ( <PaywallSheet paywall={paywall} onPurchase={(p) => console.log(`Purchased: ${p.productId}`)} /> ) : null; }
API Reference

Core API Endpoints

RESTful API with JSON request/response. Authenticated via X-PayGate-Key header.

POST /api/v1/paywalls/evaluate

Evaluate rules and return the matching paywall, variant, and offerings for a user context. The core endpoint your app calls to decide what to show.

POST /api/v1/purchases/validate

Validate a purchase receipt from Apple or Google. Creates/updates the purchase record and grants entitlements automatically.

GET /api/v1/entitlements/{user_id}

Get all active entitlements for a user. Resolves across purchases, promos, and admin grants with automatic stacking.

POST /api/v1/events

Track paywall events (impressions, taps, purchases). Supports single events and batch mode (up to 500 per request).

POST /api/v1/promos/redeem

Redeem a promo code. Validates the code, checks usage limits and expiry, and grants the associated entitlement.

Questions?

Check out the GitHub repo for full API documentation, or reach out to the team.

View on GitHub Contact Us