Skip to content

Commit 8037ca3

Browse files
authored
Docs/update docs (#67)
* Expo sdk - Added warning about handling erros in onPurchase callback of PurchaseController Provider * added support docs
1 parent 266dc32 commit 8037ca3

6 files changed

Lines changed: 189 additions & 2 deletions

content/docs/expo/sdk-reference/components/CustomPurchaseControllerProvider.mdx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,29 @@ export default function App() {
3838
}
3939
```
4040

41+
<Warning>
42+
**Important:** The `onPurchase` and `onPurchaseRestore` callbacks communicate success or failure through how the Promise resolves:
43+
44+
- **Promise resolves normally** → Superwall records a successful purchase (counts as a conversion)
45+
- **Promise throws an error** → Superwall records a failed/cancelled purchase
46+
47+
You **must** throw an error for any non-successful outcome (user cancelled, payment failed, etc.). If your purchase function returns a status like `'cancelled'` or `'error'`, you need to check it and throw:
48+
49+
```tsx
50+
onPurchase: async (params) => {
51+
const result = await yourPurchaseFunction(params.productId);
52+
53+
if (result !== 'success') {
54+
throw new Error(`Purchase ${result}`);
55+
}
56+
57+
// Only reaches here on success
58+
},
59+
```
60+
61+
**Why this matters:** If your callback resolves without throwing (even when the purchase failed), Superwall will incorrectly count it as a conversion.
62+
</Warning>
63+
4164
## Props
4265

4366
### `controller`
@@ -115,5 +138,4 @@ For a complete RevenueCat integration with error handling, subscription status s
115138
## Notes
116139

117140
- The provider must wrap your app at a level where both the Superwall SDK and your purchase logic can access it
118-
- Purchase success/failure handling is automatic - you just need to perform the actual purchase
119-
- **Important:** The `onPurchase` and `onPurchaseRestore` callbacks should not return any values. Success is indicated by the Promise resolving normally, and failure by throwing an error
141+
- Purchase success/failure handling is automatic - you just need to perform the actual purchase
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: "Can I pre-authenticate users on the subscription management page?"
3+
---
4+
5+
6+
Short Answer
7+
------------
8+
9+
No: for security reasons, users always need to verify their email by clicking a magic link sent to their inbox.
10+
11+
Pre-filling the Email Field
12+
---------------------------
13+
14+
While full pre-authentication isn't possible, you can pre-fill the email field by passing it as a query parameter:
15+
16+
```
17+
https://{your-app}.superwall.app/manage?email=user@example.com
18+
```
19+
20+
This way, when users open the subscription management page from within your app, their email will already be populated. They just need to tap "Continue" and then click the link in their inbox to access their subscription details.
21+
22+
Why Magic Link Verification is Required
23+
---------------------------------------
24+
25+
The subscription management page gives users access to sensitive account information and the ability to modify their subscription. Email verification via magic link ensures that only the actual account owner can access these controls, even if someone else has access to the device.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: "How do I migrate my existing purchases to RevenueCat?"
3+
---
4+
5+
6+
Overview
7+
--------
8+
9+
If you're migrating to RevenueCat, Superwall can help export your existing user and purchase data to facilitate the transition.
10+
11+
What We Can Export
12+
------------------
13+
14+
* **User IDs**: Your Superwall app user identifiers
15+
16+
* **Original Transaction IDs**: Apple's unique subscription identifiers
17+
18+
Note: We don't have access to receipts or receipt-type metadata, but RevenueCat has historically accepted original transaction IDs for migration purposes.
19+
20+
The Process
21+
-----------
22+
23+
1. **Open a support ticket with RevenueCat**: They'll provide specific requirements for the data import
24+
25+
2. **Contact Superwall support**: Once RevenueCat confirms what they need, let us know and we'll coordinate the export
26+
27+
3. **Receive your CSV**: We'll provide a CSV with `app_user_id` and `store_transaction_id` columns
28+
29+
RevenueCat recommends excluding sandbox transactions if appropriate, as sandbox volume can be very large.
30+
31+
Pricing
32+
-------
33+
34+
* **First 1,000 users:** Free
35+
36+
* **Additional users:** $0.20 per exported subscription
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: "Why is my Android app missing historical revenue data after setting up the Google Play integration?"
3+
---
4+
5+
6+
The Issue
7+
---------
8+
9+
After setting up the Google Play integration for your Android app, you may notice that historical subscriber data, ARR, and MRR from before the integration aren't showing up. This is different from iOS, where historical data appears after connecting App Store Connect.
10+
11+
Why This Happens
12+
----------------
13+
14+
This is due to a fundamental platform difference between Apple and Google:
15+
16+
### iOS (App Store Connect)
17+
18+
Apple provides a **Transaction History API** that allows Superwall to retrieve historical purchases retroactively. This is why your iOS app shows data from before the integration was set up.
19+
20+
### Android (Google Play)
21+
22+
Google Play **does not offer an equivalent API**. Their system only sends real-time notifications going forward from when the integration is configured. There is no way to pull historical transaction data.
23+
24+
What You Can Expect
25+
-------------------
26+
27+
* This is a Google platform limitation, not something Superwall can work around
28+
29+
* All new Android subscription events from the integration point forward will be tracked correctly
30+
31+
* Your metrics will become more complete over time as new events come in
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: "Why is my transaction failure rate high?"
3+
---
4+
5+
6+
What is a "Failed Checkout"?
7+
----------------------------
8+
9+
A failed checkout occurs when a user taps to purchase, the payment sheet appears (Apple Pay or Google Pay), but the payment system returns an error before the transaction completes.
10+
11+
Common Causes
12+
-------------
13+
14+
Failed checkouts are typically caused by:
15+
16+
* **Declined payment methods**: Insufficient funds, expired cards, or invalid payment details
17+
18+
* **Fraud prevention**: Apple or Google's systems blocking suspicious transactions
19+
20+
* **Network issues**: Connectivity problems during the payment flow
21+
22+
* **User cancellation**: User dismissing the payment sheet after it appears
23+
24+
25+
What's a Normal Failure Rate?
26+
-----------------------------
27+
28+
A transaction failure rate of **5-6%** is within industry standards. Some variance is expected depending on your audience demographics and geographic distribution.
29+
30+
What You Can and Can't Control
31+
------------------------------
32+
33+
### Can't control
34+
35+
These failures happen entirely within Apple's or Google's payment infrastructure, between the user and their payment provider. Neither Superwall nor your app can influence these outcomes.
36+
37+
### Can control
38+
39+
While you can't prevent payment-side failures, you can optimize:
40+
41+
* **Paywall UX**: Clear pricing and value proposition
42+
43+
* **Audience targeting**: Showing paywalls to users more likely to convert
44+
45+
* **Timing**: Presenting offers at optimal moments in the user journey
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: "Why are my trials still showing as pending after they should have converted?"
3+
---
4+
5+
Understanding Pending Trials
6+
----------------------------
7+
8+
If you're seeing trials that remain in "pending" status long after the trial period should have ended, this is usually expected behavior related to how Apple handles billing.
9+
10+
Common Causes
11+
-------------
12+
13+
### Billing Retry Period
14+
15+
When a user has a billing issue (e.g., expired card, insufficient funds), Apple doesn't immediately cancel the subscription. Instead, Apple will **retry billing for up to 16 days**. During this entire period, the trial remains in "pending" status in Superwall.
16+
17+
### Billing Grace Period
18+
19+
Your billing grace period setting in App Store Connect affects how long users stay in pending status. This is configurable and can be tuned based on your preferences.
20+
21+
What You Can Do
22+
---------------
23+
24+
* **Check App Store Connect** — Review your billing grace period settings and adjust if needed
25+
26+
* **Expect some delay** — It's normal to see a significant number of pending trials due to billing retries
27+
28+
* **Wait for resolution** — Most pending trials will resolve within 16 days as either converted or cancelled

0 commit comments

Comments
 (0)