Skip to content
Projets

À propos

Simplifiez les achats intégrés et les abonnements. Compatible avec iOS, watchOS, tvOS, macOS et visionOS.

Développement web et applicatif

Comment ces chiffres sont mesurés

Progression mesurée des étoiles

in 24h
0
in 7 days
+2
in 15 days
+6
in 1 month
+11

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

purchases-ios

The RevenueCat SDK for Apple platforms. It wraps StoreKit and handles purchases, entitlements, and subscription status.

GitHub release License: MIT Swift Package Index platforms

Docs · Install guide · SDK reference · Sample app · Changelog · Migration guide

Requirements

Requirement Minimum
iOS 13.0
iPadOS 13.0
macOS 10.15
Mac Catalyst Supported
tvOS 13.0
watchOS 6.2
visionOS 1.0
Xcode 15.0

Paywalls need iOS 15, Mac Catalyst 15, or macOS 12 or later. macOS doesn't support legacy paywalls. Customer Center needs iOS 15 or Mac Catalyst 15 or later. Neither is available on tvOS, watchOS, or visionOS.

Installation

Install with Swift Package Manager. In Xcode, choose File > Add Package Dependencies and enter this URL:

https://github.com/RevenueCat/purchases-ios-spm.git

Set Dependency Rule to Up to Next Major Version from 5.0.0, then add the RevenueCat product to your app target. Add RevenueCatUI too if you show Paywalls or Customer Center. Use purchases-ios-spm.git throughout your project. Referencing both it and purchases-ios.git causes duplicate-target errors.

Then add the In-App Purchase capability under Signing & Capabilities. Test Store purchases work without it.

  • CocoaPods: releases end December 2, 2026, and existing versions stay available. To keep getting updates, migrate to Swift Package Manager.
  • Carthage: add github "revenuecat/purchases-ios" to your Cartfile and run carthage update --use-xcframeworks. See the Carthage steps.
Package What it's for When you need it
RevenueCat Purchases, entitlements, subscription status Always
RevenueCatUI Paywalls and Customer Center You show RevenueCat Paywalls or Customer Center
RevenueCatAdMob Tracks AdMob ad events in RevenueCat You show AdMob ads. Separate package; needs iOS 15 or later

Quick start

Before you start, create a RevenueCat project, connect your store or start with the Test Store, and add an entitlement. See the Quickstart.

Configure Purchases once at app launch with your public API key (the Test Store key while you test). Omit appUserID to have RevenueCat generate an anonymous ID. This SwiftUI example needs iOS 14 or later. If your app targets iOS 13, configure in your app delegate instead, as in MagicWeather's AppDelegate.

import SwiftUI
import RevenueCat

@main
struct SampleApp: App {
    init() {
        Purchases.logLevel = .debug
        Purchases.configure(withAPIKey: <public_apple_api_key>, appUserID: <app_user_id>)
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

Check whether the user has an active entitlement before you show a paywall:

let customerInfo = try await Purchases.shared.customerInfo()
if customerInfo.entitlements.all[<your_entitlement_id>]?.isActive == true {
    // User is "premium"
}

What's included

  • Paywalls: build single-screen or multi-step paywalls in the dashboard and change them without an app update.
  • Customer Center: a self-service screen where users cancel, restore purchases, request refunds, and change plans.
  • Placements: serve a different Offering at each paywall location in your app.
  • Test Store: test purchases before you set up App Store Connect.
  • In-app currency: read the current Customer's in-app currency balances.
  • Redemption Links: unlock a web purchase in your app from a deep link.
  • iOS subscription offers: promotional offers, the offer code redemption sheet, and win-back offers.
  • Your own purchase code: set purchasesAreCompletedBy to keep completing purchases with your existing StoreKit code.
  • Offline entitlements: the SDK grants entitlements for new subscription purchases while RevenueCat's servers are down. It's unavailable when your app completes purchases itself.
  • Trusted Entitlements: the SDK checks a signature on entitlement data so your app can detect tampered responses. It runs in informational mode by default: it reports the result and doesn't block access.
  • Ad Monetization: report ad impressions, clicks, and revenue next to subscription data (iOS 15 or later). The AdMob adapter tracks AdMob events automatically.

Documentation

Using an AI coding agent

Your agent's training data is likely older than the current version of this SDK. Point it at current sources:

  • llms.txt: an index of the docs. Add .md to any docs URL for a Markdown version.
  • RevenueCat MCP server: lets your agent read and change your RevenueCat project configuration.
  • AI Toolkit: installs RevenueCat skills and the MCP server in one step.
  • Releases: check the latest version before adding the dependency.

Sample apps

  • MagicWeather: a UIKit app that configures the SDK, shows a paywall, checks subscription status, and restores purchases.
  • MagicWeatherSwiftUI: a SwiftUI app that configures the SDK, builds a custom paywall from Offerings, checks subscription status, and restores purchases.

Getting help

Contributing

This repository is published from the main branch and release tags of RevenueCat's internal development repository. Issues are tracked here. Pull requests are welcome: a maintainer reviews them here and brings accepted changes into the internal repository, so they can't be merged directly.

See the contributing guide.

For iOS paywalls and workflows, use unit tests for SDK logic, PaywallFixtures for offline interaction tests, and Emerge snapshots for visual changes. Maestro checks complete app flows. PerformanceTests measures peak memory. The workflow runner measures main-thread CPU during presentation and navigation. See the iOS test guide for local commands and PR checks.

License

MIT. See LICENSE.

Explorer des projets similaires

Chargement…