Sanniv Khare 7 min read

react-native-purchases 12: the native diff and the SwiftPM move

react-native-purchases 12: the native diff and the SwiftPM move

The short version: react-native-purchases 12.0.0 (27 Nov 2026) and 12.1.0 (1 Dec 2026) need React Native 0.88 or later and install on iOS through Swift Package Manager only. If your app cannot move off CocoaPods yet, stay on 11.1.1 (30 Nov 2026), which still gets native core updates. If it can, upgrade React Native first, convert the iOS project to SwiftPM second, and bump the SDK last. The app-facing API change is small: one config default moved to the native side, a few names became type-only exports, and Jest mocks that spread Purchases stop working.

We diffed the npm packages of react-native-purchases 11.1.1, 12.0.0 and 12.1.0 (npm pack, then a recursive diff of ios/, android/, dist/, the podspec and Package.swift) and read RevenueCat’s v12 migration notes and SwiftPM guide. Everything below comes from those files and pages.

Why we did this: the Beacon-type banking apps and Shopkeeper-style retail apps we build in React Native carry subscriptions, and this is the upgrade we schedule before a holiday code freeze.

What moved in the package

react-native-purchases 11.1.1 vs 12.1.0: package.json, podspec, Gradle and dist changes side by side

The lines that changed between the two packages, from our diff.

Only 19 files differ between 11.1.1 and 12.1.0 (ignoring source maps), plus a new src/ folder. The important ones:

File 11.1.1 12.1.0
package.json peer react-native >= 0.80.0 >= 0.88.0
package.json "react-native" entry dist/index.js src/index (TypeScript source)
Package.swift hybrid-common pin exact: "20.16.0" exact: "21.3.0"
RNPurchases.podspec PurchasesHybridCommon '20.16.0' PurchasesHybridCommon '21.3.0'
android/build.gradle purchases-hybrid-common:20.16.0 purchases-hybrid-common:21.3.0
ios/RNPurchases.m, RNPurchasesModule.java new config fields, two new events, two new methods
dist/purchases.js 93 Purchases.x = function assignments 100 static class methods

12.0.0 itself is mostly packaging: its native sources differ from 11.1.1 only in the version string, and it pins hybrid-common 21.0.0. The native API changes arrived in 12.1.0.

iOS: SwiftPM only, even though a podspec still ships

RevenueCat’s v12 migration guide says its Apple dependencies are no longer published to CocoaPods from this major on, and the 12.0.0 release notes say “Migrate before upgrading or stay on 11.x”. The package README now states CocoaPods “isn’t supported”.

The 12.1.0 tarball still contains RNPurchases.podspec, pinned to PurchasesHybridCommon '21.3.0'. On 2 Dec 2026 the CocoaPods CDN index for PurchasesHybridCommon lists versions up to 20.16.0 and nothing in 21.x. So a Podfile-based app that autolinks RNPurchases 12 asks CocoaPods for a version trunk does not have. Do not read the podspec’s presence as CocoaPods support.

The Package.swift sets platforms: [.iOS("15.1")] and pulls purchases-hybrid-common from GitHub at exact: "21.3.0". React Native’s autolinker resolves it; RevenueCat says not to add its packages in Xcode by hand, because duplicates cause errors.

The conversion, in RevenueCat’s order

Their CocoaPods to SwiftPM guide runs it like this (CocoaPods stays installed during the conversion, because the tool uses it to remove the old integration):

# 1. upgrade react-native-purchases and react-native-purchases-ui
#    to the same version; do NOT run pod install afterwards

# 2. convert the Xcode project
npx react-native spm add --deintegrate

# 3. no other pods left? remove CocoaPods files
rm -rf ios/Podfile ios/Podfile.lock ios/Pods

# 4. build and check
npx react-native run-ios

The guide also asks for the SwiftPM-aware Community CLI (@react-native-community/cli and cli-platform-ios at 21.0.0 or later). CLI 21.1 goes further and makes SwiftPM the default for new projects; we covered that in React Native CLI 21.1 init uses SwiftPM.

If you keep other pods

Apps with native dependencies outside React Native can keep a Podfile, but RevenueCat lists cleanup by hand: remove leftover use_react_native! arguments, React Native require lines, react_native_post_install and the old config variable, then replace min_ios_version_supported with your deployment target. That matches what we saw on React Native 0.88.1, where --deintegrate strips the Podfile lines by pattern and leaves use_react_native! arguments behind, so the Podfile no longer parses until you fix it. Check every remaining pod so none brings in a second copy of React Native or RevenueCat.

For Expo apps the floor is SDK 58, where Expo’s SwiftPM support is a preview, and the README notes iOS 16.4 with Xcode 26.4 for that case. If any native dependency still needs CocoaPods, RevenueCat’s advice is to stay on SDK 11. Our SwiftPM vs CocoaPods build-time post has the background on the React Native side of the switch.

Android: one pin and three new parameters

Android needs no build-system change. android/build.gradle keeps reading compileSdkVersion, minSdkVersion and targetSdkVersion from the host project, and only the hybrid-common artifact moves to 21.3.0. The README’s floors are Android 7.0 (API 24), compile SDK 35 and Kotlin 2.1.0.

RNPurchasesModule.setupPurchases in 12.1.0: automaticDeviceIdentifierCollectionEnabled becomes nullable, three parameters added

The bridge signature from the 12.1.0 Java source; the Objective-C side changes the same way.

setupPurchases gets three trailing parameters (iamEnabled, keychainAccessGroup, deviceIdentifierCollectionMode), and automaticDeviceIdentifierCollectionEnabled turns from boolean into a nullable Boolean (a nullable NSNumber on iOS). The module also adds an invalidate() override that removes its authentication listener, but only when the shared Purchases instance is still the one it registered on, and it holds the React context through a WeakReference.

None of this needs code in your app: the JavaScript layer passes the arguments. It matters if you patch the native module (with patch-package, say), because a patch written against 11.x will no longer apply.

The JavaScript changes that reach app code

The device identifier default moved

In 11.1.1, configure() defaulted automaticDeviceIdentifierCollectionEnabled = true in JavaScript. In 12.1.0 it has no JavaScript default and passes undefined through, so the native SDK’s own default applies. The flag is deprecated in favour of deviceIdentifierCollectionMode, with three values in purchases-typescript-internal 21.3.0: AUTOMATIC (the default), FUNCTIONAL and MANUAL_ONLY. The type docs map the old flag as AUTOMATIC for true and FUNCTIONAL for false.

import Purchases from 'react-native-purchases';

// 11.x
Purchases.configure({
  apiKey,
  automaticDeviceIdentifierCollectionEnabled: false,
});

// 12.1
Purchases.configure({
  apiKey,
  deviceIdentifierCollectionMode:
    Purchases.DEVICE_IDENTIFIER_COLLECTION_MODE.FUNCTIONAL,
});

If a privacy review signed off on what your app sends, set the mode explicitly rather than relying on a default that now lives in native code.

Type-only exports

LogHandler, CustomerInfoUpdateListener, MakePurchaseResult, LogInResult, PurchasesAreCompletedBy, PurchasesAreCompletedByMyApp, DangerousSettings and a few more are now re-exported with export type. They were always types, so plain imports keep working in most setups, but with verbatimModuleSyntax or isolatedModules TypeScript wants import type { LogHandler } from 'react-native-purchases'.

Jest mocks that spread Purchases

The precompiled dist/ (still used by Jest and Node) now targets ES2016 and keeps static class methods. Static methods are not enumerable, so {...Purchases} and Object.keys(Purchases) come back without them. A manual mock built by spreading the real module loses every method:

// breaks on 12.x: spread copies no static methods
jest.mock('react-native-purchases', () => ({
  ...jest.requireActual('react-native-purchases'),
}));

// works: spy on the methods you use
import Purchases from 'react-native-purchases';
jest.spyOn(Purchases, 'getCustomerInfo').mockResolvedValue(info);

Metro and Re.Pack now compile the SDK’s TypeScript from node_modules ("react-native": "src/index"), so a custom Babel config has to handle TypeScript in that package.

New, experimental: token-based sessions

12.1.0 adds iamEnabled and, iOS only, keychainAccessGroup to configure(), plus logInWithIdentity(), getCurrentAccessToken(), and listeners for authentication errors and access token updates (native events Purchases-AuthenticationError and Purchases-AccessTokenUpdated). Every one of them is marked @experimental in the type docs, and iamEnabled defaults to false, so nothing changes unless you opt in. We would not build a login flow on it before it loses that tag.

The upgrade order

The upgrade order: React Native 0.88, then SwiftPM, then react-native-purchases 12

Each step builds on the one before; skipping ahead leaves the iOS build with nothing to resolve.

  1. React Native 0.88 or later. The peer dependency enforces it on every platform, not only iOS.
  2. SwiftPM for iOS. Check that every library with native iOS code ships a Package.swift; spm add tells you which ones do not.
  3. react-native-purchases 12 and react-native-purchases-ui at the same version. RevenueCat asks for matching versions across all its add-on packages.

What to check on your own app

  • Run grep -rn "automaticDeviceIdentifierCollectionEnabled" src/ and replace each hit with an explicit deviceIdentifierCollectionMode.
  • Search your test setup for ...jest.requireActual('react-native-purchases') and switch to jest.spyOn.
  • If you keep a Podfile, open it after spm add --deintegrate and confirm ruby -c ios/Podfile passes.
  • Look in patches/ for anything touching RNPurchasesModule.java or RNPurchases.m.
  • Android: RevenueCat’s README asks for launchMode standard or singleTop on the Activity that starts purchases; new React Native projects use singleTask, which can cancel a purchase while the user confirms payment in another app.
  • Then do what the guide asks before release: a Release build, archive validation, fetching offerings and one test purchase, plus your paywalls and Customer Center if you use RevenueCat UI.

Made by the team behind this post

Apps from our studio

  • Goes with this post

    Cardigami

    Pop-up greeting cards that rise out of the fold on iPhone Duo.

    iPhone · App Store

    Get
  • Goes with this post

    BMDB.fun

    Your Bollywood world at a glance, with links straight to the OTT app that streams each film.

    Android TV · Web · Mobile

    Get
  • Nix

    The Mac uninstaller that finds what the Trash leaves behind: caches, logs, derived data and saved states.

    macOS

    Get
  • OneClick QuitAll

    Quit every running app in one click. See memory and CPU first.

    macOS · Mac App Store

    Get

Need this built? Let’s talk.

We build and run apps for Mac, TV, mobile and the web, and write about what we learn.