Purpl
Docs menu

Purpl Docs

Quick start

Choose one integration path and complete the minimum setup and first request.

Swift SDK only

Configure every product and entitlement in app code without a Purpl account or server.

  • Add Purpl-Swift in Xcode Package Dependencies.
  • Define every app product and entitlement in PurchaseConfiguration.
  • Call Purchases.configure at launch and read access from CustomerInfo.
Package URL
https://github.com/ineedtoint/Purpl-Swift.git
Swift
import Purpl

let plusEntitlement = PurchaseEntitlement(identifier: "plus")

let monthlyProduct = PurchaseProduct(
    productIdentifier: "time.plus.monthly",
    entitlementIdentifier: plusEntitlement.identifier
)
let yearlyProduct = PurchaseProduct(
    productIdentifier: "time.plus.yearly",
    entitlementIdentifier: plusEntitlement.identifier
)

let purchaseConfiguration = PurchaseConfiguration(
    entitlements: [plusEntitlement],
    products: [monthlyProduct, yearlyProduct]
)

Purchases.configure(purchaseConfiguration)
Swift
let customerInfo = try await Purchases.shared.customerInfo()

if customerInfo.isEntitlementActive("plus") {
    enablePremiumFeatures()
}

Swift SDK with the Purpl service

Manage sales configuration and customer access on the web while the Swift app loads the active configuration by paywall identifier.

  • Create an application and connect its store in Purpl.
  • Map products to entitlements, then create a catalog and paywall.
  • Configure the Swift app in server mode and pass the paywall identifier created on the web.
Swift
import Purpl
import PurplUI

Purchases.configure(entitlementMode: .server)

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

Server API

Use an application API credential when your trusted server needs account linking or entitlement lookup.

  • Create an application API credential in Purpl.
  • Keep the credential on your trusted server and never include it in the app.
  • Call the required customer or entitlement endpoint with Bearer authentication.
cURL
curl 'https://api.purpl.sh/v1/customers/user-123/entitlements' \
  --header 'Authorization: Bearer <application-api-credential>'