notes/revenuecat-paywall-hangs-capacitor.md Hire me
← devpresso.dev

Note · 2026-11-18

Why your RevenueCat paywall hangs forever in Capacitor

The symptom

On iOS the paywall spinner never stops. Nothing throws, nothing times out, and the console has nothing that points at the paywall. An await on the RevenueCat SDK simply never returns. The same code works in the browser, so it looks like a native or StoreKit problem, and App Review rejects the build for a paywall that loads indefinitely.

The usual trigger is lazy-loading the SDK, which is sensible in a Capacitor app that also ships to web or desktop:

let purchasesPromise;

function getPurchases() {
  purchasesPromise ??= import("@revenuecat/purchases-capacitor")
    .then((mod) => mod.Purchases); // resolves with the plugin proxy
  return purchasesPromise;
}

const Purchases = await getPurchases(); // never returns

Why it never settles

Capacitor registers every native plugin as a JavaScript Proxy. Its get trap special-cases four names ($$typeof, toJSON, addListener, removeListener) and answers every other property with a function that forwards the call to the native side. That includes then.

So the plugin object looks like a promise. When a promise is resolved with a value that has a callable then, the JavaScript engine does not hand the value over. It adopts it: it calls value.then(resolve, reject) and waits for one of those two callbacks.

typeof Purchases.then; // "function"

// Resolving a promise with a thenable adopts it:
// the engine calls Purchases.then(resolve, reject)
// and waits for one of those callbacks.

With the plugin proxy, that call goes to a native method named then, which does not exist. The failure lands on a separate promise nobody is holding, at most an unhandled rejection saying Purchases.then() is not implemented, and the resolve and reject the engine passed in are never called. The promise you are awaiting stays pending forever.

Anything that resolves a promise with the proxy does this: returning it from an async function, returning it from a .then callback, or Promise.resolve(Purchases). It is not specific to RevenueCat either; any Capacitor plugin object behaves the same way.

The fix

Never let a promise resolve with the plugin object. Put it in a plain object and take it out after the await:

function getPurchases() {
  purchasesPromise ??= import("@revenuecat/purchases-capacitor")
    .then((mod) => ({ Purchases: mod.Purchases })); // a box, not the proxy
  return purchasesPromise;
}

const { Purchases } = await getPurchases(); // resolves

The box has no then, so the promise resolves normally, and destructuring it afterwards is a plain property read with no promise involved.

Two related guards worth adding while you are in there:

  • Run configure() once and make every SDK call wait for it. A paywall that opens quickly can otherwise reach the SDK before it is configured, and that call is rejected.
  • Put a timeout on loading the SDK and on fetching offerings, and do not cache a failed load, so the paywall can show a retry instead of spinning.

This was the root cause behind a stuck App Store release I fixed. The full story is in the Dash case study.

Paywall or purchases misbehaving?

Include what you're building, your stack, and your deadline. Or book a call.

Tell me what you're building