activeSubscriptions returns all previous user purchases #3051
Replies: 2 comments
-
|
I should add that if I change test user from settings, it fetches all its previous purchase history |
Beta Was this translation helpful? Give feedback.
-
|
This is a known difference between StoreKit Configuration (Debug) and Sandbox/Production (Release) environments. The Issue
Why This HappensStoreKit Configuration files behave differently from the actual Sandbox environment. According to Apple's documentation:
The WorkaroundFilter the results by checking const { activeSubscriptions } = useIAP();
// Filter to only truly active subscriptions
const trulyActive = activeSubscriptions.filter(sub => {
// Check isActive flag
if (!sub.isActive) return false;
// Double-check expiration date if available
if (sub.expirationDateIOS) {
return sub.expirationDateIOS > Date.now();
}
return true;
});Important Notes
References |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description: Should
getActiveSubscriptionsandactiveSubscriptionsreturn all previous user purchases? I'm working on implementing subscriptions support for ios app and stuck with weird behavior on getting active subscriptions for test users. In dev mode everything seems OK, but when I switch xcode scheme to Release I started to get all prev subscriptions fromactiveSubscriptionspropSteps to reproduce:
activeSubscriptions: [{THIS_ACTIVE_SUB}]activeSubscriptions: []activeSubscriptions.Expected behavior: seems like if user doesn't have any active sub at the moment
activeSubscriptionsmust be empty, right?Beta Was this translation helpful? Give feedback.
All reactions