Skip to content

CustomPurchaseControllerProvider onPurchase not called on cold boot - purchase hangs with spinner #157

@appdevexpert

Description

@appdevexpert

Summary

CustomPurchaseControllerProvider's onPurchase handler is never called on cold boot. The purchase button shows a spinner indefinitely and the native StoreKit popup never appears. After hot reload/refresh, everything works perfectly.

Environment

expo-superwall: 1.0.1
Expo SDK: [53.0.22]
Platform: iOS
React Native: [0.79.4]

Behavior

Cold Boot (❌ Broken):

User clicks purchase button on paywall
Spinner appears and spins forever
Native StoreKit purchase popup never appears
onPurchase handler never called
No Superwall events logged via useSuperwallEvents

After Refresh/Hot Reload (✅ Works):

User clicks purchase button
Native StoreKit popup appears immediately
onPurchase handler called correctly
All Superwall events fire properly
Purchase completes successfully

Reproduction Steps

Set up CustomPurchaseControllerProvider with onPurchase handler
Force quit app completely
Launch app fresh (cold boot)
Open paywall and click purchase button
Result: Spinner hangs, onPurchase never called
Refresh app (⌘R) without force quit
Click purchase again
Result: Works perfectly

Root Cause

On cold boot, useSuperwallEvents (which CustomPurchaseControllerProvider uses internally) doesn't receive ANY events from native Superwall - not even paywallOpen or transactionStart. The native-to-JS event bridge appears to not initialize properly on first launch.

Reproducible in Example App

This issue can be reproduced in the official expo-superwall example app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions