Purpl
Docs menu

Purpl Docs

Connect the Purpl service

Connect managed catalogs and server entitlements to a Swift app.

Prepare the service

  • Register the app and Apple store in Purpl.
  • Connect products to entitlements.
  • Create a catalog and a paywall that uses it.

Configure server mode

Server mode can load product and entitlement configuration from Purpl without a local PurchaseConfiguration. The SDK resolves the active configuration using the bundle identifier and paywall identifier.

Swift
import Purpl
import PurplUI

Purchases.configure(entitlementMode: .server)

PaywallView(paywallIdentifier: "standard") {
    PremiumMarketingContent()
}

Local paywall fallback

Pass a local paywall configuration as fallbackConfiguration when a remote paywall should remain available during a network failure or an unsuccessful first request. Even in server mode, Purchases.configure must receive a local PurchaseConfiguration when this fallback is used.

SwiftUI
import Purpl
import PurplUI

Purchases.configure(
    purchaseConfiguration,
    entitlementMode: .server
)

PaywallView(
    paywallIdentifier: "standard",
    fallbackConfiguration: PaywallConfiguration(
        catalog: standardCatalog,
        defaultProductIdentifier: yearlyProduct.productIdentifier
    )
) {
    PremiumMarketingContent()
}

Remote configuration priority

The SDK presents a cached remote configuration first and refreshes it in the background. When no cache exists, it immediately presents the local fallback and requests the remote configuration. A successful response replaces the fallback. The SDK waits for the first server response and returns an error only when neither a cache nor a local fallback is available.