You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### I sometimes see both a success and an error for one subscription purchase
258
+
259
+
This can briefly happen due to StoreKit 2 event ordering and native background work. If you've already received a success and processed it, you can safely ignore a transient error that arrives shortly afterwards.
if (dt>=0&&dt<1500) return; // Ignore spurious error
276
+
}
277
+
Alert.alert('Purchase Failed', error.message);
278
+
},
279
+
});
280
+
```
281
+
282
+
Because of this timing model, all request* APIs (e.g., `requestPurchase`) are event-driven, not promise-based:
283
+
284
+
-`requestPurchase()` does not resolve with a result. It triggers the native flow and you must handle outcomes via `onPurchaseSuccess`/`onPurchaseError` (when using `useIAP`) or `purchaseUpdatedListener`/`purchaseErrorListener`.
285
+
- Avoid relying on `await requestPurchase(...)` for the final outcome; multiple events and inter-session completions are possible.
286
+
- This design ensures your app remains robust when the store delivers updates after app restarts or in edge timing cases.
287
+
257
288
### How do I handle network errors during purchases?
258
289
259
290
Network errors during purchases are tricky because the purchase might still go through. Always:
0 commit comments