@superwall/cli 2.6.0-beta.2 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -16
- package/dist/{apple-Dc5pOPms.js → apple-BE1GBJFP.js} +17 -19
- package/dist/{approve-BSbdmOez.js → approve-yRZmvkCj.js} +9 -11
- package/dist/{assets-C_RjojkK.js → assets-DTAgbWw0.js} +3 -3
- package/dist/auth.d.ts +11 -4
- package/dist/auth.js +4 -5
- package/dist/base-zc1wl_9b.js +82 -0
- package/dist/{billing-B6HK-F_a.js → billing-C1LV4-BN.js} +3 -3
- package/dist/{build-DK88pTMW.js → build-CQd-pf7O.js} +35 -16
- package/dist/{client-x08fpvay.js → config-DCqRQTJ4.js} +162 -15
- package/dist/create-CSHGZDfB.js +18 -0
- package/dist/{create-kpqEhqkk.js → create-Costu6UT.js} +9 -9
- package/dist/{create-B6-Dr3GZ.js → create-wlCp83IH.js} +41 -41
- package/dist/{doctor-DYbm8IKQ.js → doctor-Bd9ffg51.js} +50 -10
- package/dist/entry.js +45 -40
- package/dist/{environment-BFNzLLPN.js → environment-Dn7irhZr.js} +1 -1
- package/dist/{drivers-Dyi-y9Jn.js → existing-BQMB_2AG.js} +305 -8
- package/dist/framework-DW5fqjh4.js +65 -0
- package/dist/{source-BccdO4aL.js → git-Hf9Wc7Hp.js} +34 -92
- package/dist/{held-sKq3xrsT.js → held-D5wSX2Mf.js} +9 -9
- package/dist/held-Dmf5SR3p.js +15 -0
- package/dist/{install-DsIsif39.js → install-CxyqfKFe.js} +15 -17
- package/dist/{integrate-B8eA676b.js → integrate-MkyDDzI5.js} +33 -38
- package/dist/{login-BlpfYapG.js → login-B7IqDafm.js} +3 -3
- package/dist/{login-Blhxi20A.js → login-BMHDhxAx.js} +8 -9
- package/dist/login-Cp0-BgDZ.js +13 -0
- package/dist/{lookup-Dg55W9S7.js → lookup-DkcT4E-5.js} +28 -4
- package/dist/{migrate-DoRb9jmA.js → migrate-CdFoZipj.js} +66 -45
- package/dist/{notification-url-D82msWF5.js → notification-url-D6KKeXnk.js} +4 -4
- package/dist/{open-BAqLpTSI.js → open-COJE6ryI.js} +2 -2
- package/dist/{org-C4G7WjTV.js → org-BV8wwxwc.js} +4 -4
- package/dist/{organization-CmuQwcKN.js → organization-9R_1PJKk.js} +4 -4
- package/dist/{orgs-1OzwUtpT.js → orgs-ltP8H0Nl.js} +1 -2
- package/dist/{paths-gBbqgkS7.js → paths-Cb1RfjaX.js} +1 -1
- package/dist/{playbook-BKqlv77S.js → playbook-CVGolez9.js} +10 -14
- package/dist/{products-Cqq59DBQ.js → products-CJq_iXv5.js} +1 -1
- package/dist/{promote-D0i8A0CO.js → promote-B_HnFEbX.js} +27 -28
- package/dist/{pull-DgQ_UmGv.js → pull-DF4KYVcP.js} +72 -26
- package/dist/pull-JxiMyRwY.js +30 -0
- package/dist/{pull-CiIrJ5ik.js → pull-lYRULo4v.js} +33 -39
- package/dist/push-B5py7h5y.js +29 -0
- package/dist/{push-7N4XIVtg.js → push-BZN1Qpkq.js} +23 -12
- package/dist/{push-BWsXO7FN.js → push-BnllH2Rd.js} +8 -7
- package/dist/push-DHlUMkbf.js +21 -0
- package/dist/registry-BGEYCWyD.js +22 -0
- package/dist/{registry-aAR_8VOw.js → registry-CqePfigB.js} +1287 -902
- package/dist/{resolve-CcOpO_5s.js → resolve-B4bd3Qjl.js} +4 -4
- package/dist/{resources-DNwvf8rg.js → resources-BaURbSpY.js} +15 -2
- package/dist/{run-tVYJ3V5j.js → run-Bme4Egyl.js} +15 -17
- package/dist/{scan-dv0rrY4C.js → scan-DugxddUU.js} +1 -1
- package/dist/scan-J2DILUNE.js +4 -0
- package/dist/{scope-ehZ7L1nj.js → scope-Cg1AdAfO.js} +33 -3
- package/dist/{scope-BXoQo30_.js → scope-DDYLQeZw.js} +24 -18
- package/dist/screenshot-file-Dix2Qynm.js +127 -0
- package/dist/{sdk-DEfQttek.js → sdk-BFunw4Hc.js} +1 -1
- package/dist/{framework-JFLjmD5Y.js → selection-C439nEhn.js} +4 -54
- package/dist/{series-D2ZpZ8cx.js → series-B8NJK4yS.js} +1 -1
- package/dist/{server-CcZGdYjE.js → server-C_aMxzvS.js} +40 -18
- package/dist/server-Cif9w5lM.js +33 -0
- package/dist/{session-dHBtgSN0.js → session-B7frlXXQ.js} +1 -1
- package/dist/{base-83ZTv6up.js → session-CfG3gzko.js} +8 -83
- package/dist/session-DvaPyOuH.js +5 -0
- package/dist/{migration-BUedsREQ.js → setup-DQEasPhx.js} +290 -28
- package/dist/skills/index.json +5 -0
- package/dist/skills/superwall/SKILL.md +37 -10
- package/dist/skills/superwall/references/api.md +66 -21
- package/dist/skills/superwall/references/asa.md +109 -64
- package/dist/skills/superwall/references/dashboard-links.md +65 -28
- package/dist/skills/superwall/references/data-analytics.md +1 -1
- package/dist/skills/superwall/workflows/dashboard/setup.md +15 -5
- package/dist/skills/superwall/workflows/integrate/flutter.md +9 -7
- package/dist/skills/superwall-framework/SKILL.md +248 -36
- package/dist/skills/superwall-framework/references/cli.md +98 -7
- package/dist/skills/superwall-framework/references/examples.md +2 -2
- package/dist/skills/superwall-framework/references/layout.md +30 -2
- package/dist/skills/superwall-framework/references/migrate-from-editor.md +5 -0
- package/dist/skills/superwall-framework/references/migrate-from-native.md +5 -0
- package/dist/skills/teleport/SKILL.md +154 -0
- package/dist/skills/teleport/references/experiments.md +328 -0
- package/dist/skills/teleport/references/setup.md +157 -0
- package/dist/{skills-Q7xB784d.js → skills-DnegE1A6.js} +139 -9
- package/dist/{skills-Bqz2l_bx.js → skills-MmF7IyTg.js} +8 -12
- package/dist/source-DQs6iLtC.js +82 -0
- package/dist/{source-push-CG948HrX.js → source-push-MbJjh4Ki.js} +38 -14
- package/dist/{spinner-IA6hV8nI.js → spinner-Dcr-Dqdi.js} +7 -5
- package/dist/{starter-BtUUQWhd.js → starter-BlJ_InZJ.js} +2 -2
- package/dist/{status-CB_MrFu5.js → status-DHRxg1ZA.js} +9 -11
- package/dist/{output-Ggzq5_-t.js → storage-DdIAHolY.js} +40 -1
- package/dist/storekit-De998QOt.js +203 -0
- package/dist/storekit-iBCWmeKn.js +15 -0
- package/dist/{bind-DcWIIPgk.js → theme-BrUrye-c.js} +29 -6
- package/dist/token-CKCBQ4I8.js +100 -0
- package/dist/tools-skills/animate-onboarding/SKILL.md +1 -1
- package/dist/tools-skills/mobile-design/SKILL.md +1 -1
- package/dist/tools-skills/onboarding-questions/SKILL.md +1 -1
- package/dist/tools-skills/superwall/SKILL.md +43 -17
- package/dist/tools-skills/superwall/references/api.md +74 -24
- package/dist/tools-skills/superwall/references/asa.md +109 -64
- package/dist/tools-skills/superwall/references/dashboard-links.md +65 -28
- package/dist/tools-skills/superwall/references/data-analytics.md +1 -1
- package/dist/tools-skills/superwall/workflows/dashboard/playbook.md +4 -3
- package/dist/tools-skills/superwall/workflows/dashboard/setup.md +21 -8
- package/dist/tools-skills/superwall/workflows/integrate/flutter.md +9 -7
- package/dist/tools-skills/superwall/workflows/migrate/adapty.md +4 -3
- package/dist/tools-skills/superwall/workflows/migrate/playbook.md +2 -2
- package/dist/tools-skills/superwall/workflows/migrate/qonversion.md +4 -3
- package/dist/tools-skills/superwall/workflows/migrate/revenuecat.md +4 -3
- package/dist/tools-skills/superwall-editor/SKILL.md +2 -3
- package/dist/tools-skills/teleport/SKILL.md +154 -0
- package/dist/tools-skills/teleport/references/experiments.md +328 -0
- package/dist/tools-skills/teleport/references/setup.md +157 -0
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +1232 -746
- package/dist/{try-CS3jLyoP.js → try-C8QQbG0b.js} +17 -19
- package/dist/{lock-DgSx-p8Y.js → types-Dc9U_4kp.js} +86 -80
- package/dist/upgrade-CYFdpVpi.js +27 -0
- package/dist/upgrade-D0thxCA4.js +348 -0
- package/package.json +11 -3
- package/dist/config-CGcG7GOt.js +0 -113
- package/dist/create-Du8Fx7W5.js +0 -20
- package/dist/existing-WQ3pz94o.js +0 -97
- package/dist/held-DmOhszHR.js +0 -17
- package/dist/log-C0MDCfA2.js +0 -62
- package/dist/login-D9jfRO8w.js +0 -17
- package/dist/pull-CO5HlqBe.js +0 -36
- package/dist/push-BIhGDNpL.js +0 -30
- package/dist/push-BgqTddLA.js +0 -22
- package/dist/run-B-YoyB-a.js +0 -100
- package/dist/scan-BU41gcQY.js +0 -4
- package/dist/screenshot-file-XAS0Xy0e.js +0 -16
- package/dist/server-BemmM1FV.js +0 -29
- package/dist/session-4aITGsF1.js +0 -6
- package/dist/setup-m94dpT3t.js +0 -217
- package/dist/spawn-DmmmHIP-.js +0 -71
- package/dist/storage-pR0Wb0d9.js +0 -41
- package/dist/storekit-BMxyYAHj.js +0 -17
- package/dist/storekit-CQnwlpKV.js +0 -47
- package/dist/telemetry-DU56L7Cy.js +0 -56
- package/dist/theme-DUsCh-Vd.js +0 -25
- package/dist/token-BbUeExGJ.js +0 -70
- package/dist/upgrade-CKn88PZD.js +0 -206
- package/dist/upgrade-DfD3-ClG.js +0 -7
- /package/dist/{browser-Bp3yRKlU.js → browser-BVjaf98V.js} +0 -0
- /package/dist/{client-BJQXl62Q.js → client-BwYhzITp.js} +0 -0
- /package/dist/{design-lint-CiFc78aM.js → design-lint-mgO-2SGS.js} +0 -0
- /package/dist/{devtools-ByZ6XYnn.js → devtools-B6Vp6HMy.js} +0 -0
- /package/dist/{input-MDd67UIp.js → input-DOT_2Zvb.js} +0 -0
- /package/dist/{project-NoMtbMyl.js → project-BomArwSj.js} +0 -0
- /package/dist/{reports-HYVp169R.js → reports-hbxsd3Zo.js} +0 -0
- /package/dist/{storage-Bdz5AmqS.d.ts → storage-Bh3wT1Rn.d.ts} +0 -0
- /package/dist/{timing-Ca0TXY-A.js → timing-BKEEIBij.js} +0 -0
- /package/dist/{ui-D_qf3Gvw.js → ui-hFgji1e8.js} +0 -0
|
@@ -26,7 +26,7 @@ superwall products create --identifier <identifier> \
|
|
|
26
26
|
--trial-days 7 \ # optional free-trial length
|
|
27
27
|
--entitlement pro \ # entitlement(s) to grant; repeat --entitlement for more
|
|
28
28
|
--name "Pro Yearly" \ # optional display name
|
|
29
|
-
--
|
|
29
|
+
--app <id> --json # the app the entitlement is on
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Use the **real store product identifiers** (the ones in App Store Connect / Google Play), e.g.
|
|
@@ -52,12 +52,16 @@ superwall asc iaps list com.app.bundle --json # one-time / non-renew
|
|
|
52
52
|
superwall asc products com.app.bundle --json # everything
|
|
53
53
|
superwall asc apps --json # list ASC apps if unsure of the id
|
|
54
54
|
|
|
55
|
-
# create each returned productId, granting your entitlement
|
|
56
|
-
superwall products create --identifier com.app.pro.yearly --
|
|
55
|
+
# create each returned productId with its price, period and trial, granting your entitlement
|
|
56
|
+
superwall products create --identifier com.app.pro.yearly --price 24.99 --period year \
|
|
57
|
+
--trial-days 7 --entitlement pro --app <id> --json
|
|
57
58
|
```
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
Take the price, period and trial from the ASC listing. `--price` is in major units (24.99),
|
|
61
|
+
`--currency` defaults to USD, `--period` is `day`, `week`, `month` or `year`, and
|
|
62
|
+
`--period-count` defaults to 1; leave out `--period` and `--trial-days` for a one-time product.
|
|
63
|
+
A product created without `--price` is left out of the `.storekit` export below, which writes
|
|
64
|
+
what Superwall holds.
|
|
61
65
|
|
|
62
66
|
### Generate a local `.storekit` file (for Xcode testing without sandbox)
|
|
63
67
|
|
|
@@ -65,17 +69,26 @@ the stores remain the source of truth for pricing.
|
|
|
65
69
|
superwall products storekit --project <id> --out Superwall.storekit --json
|
|
66
70
|
```
|
|
67
71
|
|
|
68
|
-
|
|
72
|
+
Writes each App Store product with its Superwall price, read in its currency's minor units
|
|
73
|
+
(399 USD is 3.99). Auto-renewable subscriptions go in one `Subscriptions` group with their
|
|
74
|
+
period, and their free or paid trial as the introductory offer; one-time products are written
|
|
75
|
+
as NonConsumable. Products of another store (Play, Stripe, custom), with no price, or with no
|
|
76
|
+
identifier are left out and named in a warning. Price one with
|
|
77
|
+
`superwall products update <id> --price '{"amount":<minor units>,"currency":"USD"}'`, where
|
|
78
|
+
`<id>` is its Superwall product id, then export again.
|
|
69
79
|
|
|
70
80
|
## Entitlements
|
|
71
81
|
|
|
72
82
|
```bash
|
|
73
83
|
superwall entitlements list --project <id> --json
|
|
74
|
-
superwall entitlements create --identifier pro --
|
|
84
|
+
superwall entitlements create --identifier pro --app <id> --json
|
|
75
85
|
```
|
|
76
86
|
|
|
77
87
|
Default to a single coarse `pro` entitlement. Add more only for genuine tiers (e.g. `pro`,
|
|
78
|
-
`team`). Products grant entitlements via `--entitlement` at create time.
|
|
88
|
+
`team`). Products grant entitlements via `--entitlement` (id or identifier) at create time.
|
|
89
|
+
Pass the same `--app <id>` to the entitlement and the product: a native product only grants
|
|
90
|
+
entitlements on its own app. CLI 2.2.1 and older take only the numeric id from
|
|
91
|
+
`superwall entitlements list --json`; run `superwall upgrade` once a newer CLI is out.
|
|
79
92
|
|
|
80
93
|
## Campaigns + placements
|
|
81
94
|
|
|
@@ -104,15 +104,17 @@ plugins { id 'com.android.application' version '8.4.1' apply false }
|
|
|
104
104
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
> **Important:**
|
|
108
|
-
> `
|
|
107
|
+
> **Important:** Do not declare `SuperwallPaywallActivity` in the app's
|
|
108
|
+
> `AndroidManifest.xml`. The `superwallkit_flutter` plugin's manifest already
|
|
109
|
+
> declares it, and a second declaration with a different theme fails the
|
|
110
|
+
> manifest merge (`Attribute activity#...SuperwallPaywallActivity@theme ... is
|
|
111
|
+
> also present at [:superwallkit_flutter]`). If the app already has one, remove
|
|
112
|
+
> it, or keep it only with `tools:replace="android:theme"`.
|
|
113
|
+
|
|
114
|
+
Optionally, add the debug activities inside the `<application>` tag of
|
|
115
|
+
`android/app/src/main/AndroidManifest.xml`:
|
|
109
116
|
|
|
110
117
|
```xml
|
|
111
|
-
<activity
|
|
112
|
-
android:name="com.superwall.sdk.paywall.view.SuperwallPaywallActivity"
|
|
113
|
-
android:theme="@style/Theme.MaterialComponents.DayNight.NoActionBar"
|
|
114
|
-
android:configChanges="orientation|screenSize|keyboardHidden">
|
|
115
|
-
</activity>
|
|
116
118
|
<activity android:name="com.superwall.sdk.debug.DebugViewActivity" />
|
|
117
119
|
<activity android:name="com.superwall.sdk.debug.localizations.SWLocalizationActivity" />
|
|
118
120
|
<activity android:name="com.superwall.sdk.debug.SWConsoleActivity" />
|
|
@@ -119,13 +119,14 @@ Produce: product ids, access-level ids (→ entitlements), and one row per `getP
|
|
|
119
119
|
## 4. Dashboard-side re-creation (CLI)
|
|
120
120
|
|
|
121
121
|
```bash
|
|
122
|
-
superwall entitlements create --identifier premium --
|
|
123
|
-
superwall products create --identifier com.app.premium_monthly --name "Premium Monthly" --
|
|
124
|
-
superwall products create --identifier com.app.premium_yearly --name "Premium Yearly" --
|
|
122
|
+
superwall entitlements create --identifier premium --app <appId> --json
|
|
123
|
+
superwall products create --identifier com.app.premium_monthly --name "Premium Monthly" --entitlement premium --app <appId> --json
|
|
124
|
+
superwall products create --identifier com.app.premium_yearly --name "Premium Yearly" --entitlement premium --app <appId> --json
|
|
125
125
|
superwall campaigns create --description "Main paywall" --placement main --project <projectId> --app <appId> --json
|
|
126
126
|
superwall campaigns placements create <campaignId> --event-name onboarding --project <projectId> --app <appId> --json
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
+
Each product MUST grant the entitlements it unlocked in the old provider (`--entitlement <identifier>`, repeat for several); a product with none unlocks nothing. CLI 2.2.1 and older take only the numeric id from `superwall entitlements list --json`.
|
|
129
130
|
Product ids MUST equal existing App Store / Play SKUs (import from ASC via `superwall asc keys create --help`).
|
|
130
131
|
Verify with the same explicit ids: `superwall entitlements list --project <projectId> --json`,
|
|
131
132
|
`superwall products list --project <projectId> --json`, and `superwall campaigns list --project <projectId> --app <appId> --json`.
|
|
@@ -69,9 +69,9 @@ Agents always use `--json` and explicit scope:
|
|
|
69
69
|
superwall whoami --json
|
|
70
70
|
superwall apps list --json
|
|
71
71
|
superwall entitlements list --project <projectId> --json
|
|
72
|
-
superwall entitlements create --identifier <id> --
|
|
72
|
+
superwall entitlements create --identifier <id> --app <appId> --json
|
|
73
73
|
superwall products list --project <projectId> --json
|
|
74
|
-
superwall products create --identifier <storeId> --
|
|
74
|
+
superwall products create --identifier <storeId> --entitlement <id> --app <appId> --json
|
|
75
75
|
superwall campaigns list --project <projectId> --app <appId> --json
|
|
76
76
|
superwall campaigns create --description "<description>" --placement <placement> --project <projectId> --app <appId> --json
|
|
77
77
|
superwall campaigns placements create <campaignId> --event-name <placement> --project <projectId> --app <appId> --json
|
|
@@ -116,12 +116,13 @@ Produce: product ids, entitlement/permission ids (→ entitlements), and one row
|
|
|
116
116
|
## 4. Dashboard-side re-creation (CLI)
|
|
117
117
|
|
|
118
118
|
```bash
|
|
119
|
-
superwall entitlements create --identifier premium --
|
|
120
|
-
superwall products create --identifier com.app.premium_monthly --name "Premium Monthly" --
|
|
121
|
-
superwall products create --identifier com.app.premium_yearly --name "Premium Yearly" --
|
|
119
|
+
superwall entitlements create --identifier premium --app <appId> --json
|
|
120
|
+
superwall products create --identifier com.app.premium_monthly --name "Premium Monthly" --entitlement premium --app <appId> --json
|
|
121
|
+
superwall products create --identifier com.app.premium_yearly --name "Premium Yearly" --entitlement premium --app <appId> --json
|
|
122
122
|
superwall campaigns create --description "Main paywall" --placement paywall_main --project <projectId> --app <appId> --json
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
+
Each product MUST grant the entitlements it unlocked in the old provider (`--entitlement <identifier>`, repeat for several); a product with none unlocks nothing. CLI 2.2.1 and older take only the numeric id from `superwall entitlements list --json`.
|
|
125
126
|
Product ids MUST equal existing App Store / Play SKUs (import from ASC via `superwall asc keys create --help`).
|
|
126
127
|
Verify with the same explicit ids: `superwall entitlements list --project <projectId> --json`,
|
|
127
128
|
`superwall products list --project <projectId> --json`, and `superwall campaigns list --project <projectId> --app <appId> --json`.
|
|
@@ -203,11 +203,12 @@ call the migration complete with dashboard work silently skipped.
|
|
|
203
203
|
For each entitlement and product found, use the project/app ids from the account gate:
|
|
204
204
|
|
|
205
205
|
```bash
|
|
206
|
-
superwall entitlements create --identifier pro --
|
|
207
|
-
superwall products create --identifier com.app.pro_monthly --name "Pro Monthly" --
|
|
208
|
-
superwall products create --identifier com.app.pro_yearly --name "Pro Yearly" --
|
|
206
|
+
superwall entitlements create --identifier pro --app <appId> --json
|
|
207
|
+
superwall products create --identifier com.app.pro_monthly --name "Pro Monthly" --entitlement pro --app <appId> --json
|
|
208
|
+
superwall products create --identifier com.app.pro_yearly --name "Pro Yearly" --entitlement pro --app <appId> --json
|
|
209
209
|
```
|
|
210
210
|
|
|
211
|
+
Each product MUST grant the entitlements it unlocked in the old provider (`--entitlement <identifier>`, repeat for several); a product with none unlocks nothing. CLI 2.2.1 and older take only the numeric id from `superwall entitlements list --json`.
|
|
211
212
|
Product ids MUST equal the existing App Store / Play SKUs (import via ASC connection instead of
|
|
212
213
|
manual create when possible - `superwall asc keys create --help`). Then one campaign with
|
|
213
214
|
a placement per call site:
|
|
@@ -18,9 +18,8 @@ description: LEGACY — drives the browser (visual) paywall editor over a pairin
|
|
|
18
18
|
> npx skills add https://github.com/superwall/skills --skill superwall-framework --global --yes --agent claude-code universal --full-depth
|
|
19
19
|
> ```
|
|
20
20
|
>
|
|
21
|
-
> The framework is in public beta
|
|
22
|
-
>
|
|
23
|
-
> it is missing; ask the user to set it in their shell rc and relaunch).
|
|
21
|
+
> The framework is in public beta and the CLI has its commands by default
|
|
22
|
+
> (an `Unknown command: create` means an older CLI: ask the user to run `superwall upgrade`).
|
|
24
23
|
>
|
|
25
24
|
> **An editor paywall moves over in one command:**
|
|
26
25
|
>
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: teleport
|
|
3
|
+
description: Set up an app-to-web flow or experiment with the superwall framework's teleport — the shopper starts on a paywall or onboarding in the iOS app and finishes on the web, paying with Apple Pay through Stripe, and the app is credited on its own. Covers the recommended setup (`teleport.route` in config.ts, the Apple Pay gate with `useApplePay().available` and `router.push(route, { teleport: false })`, `teleport.fallbacks`, blocking prepaid cards), what buying a Stripe product inside the app does, direct Apple Pay checkout (not with Stripe Managed Payments), A/B testing teleport by paywall in a campaign, and a catalogue of setups and experiments (web pricing, discounts, failure rescue, abandonment offers, custom teleport screens, trial eligibility, `completion`, attribution). Use when the user asks to "set up app to web", "app-to-web experiment", "teleport", "send users to web checkout from the app", "sell on the web from iOS", "Stripe / Apple Pay from the app", or to test web checkout against the App Store. Needs the superwall-framework skill for everything else about the paywall.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Teleport: app to web
|
|
8
|
+
|
|
9
|
+
App to web means the shopper starts in the iOS app and finishes on the web:
|
|
10
|
+
a paywall shown by SuperwallKit 4.18+ opens one of its routes in the
|
|
11
|
+
shopper's browser, they pay there with Apple Pay (Stripe), and the app is
|
|
12
|
+
credited without a restore. With the superwall framework this is one key,
|
|
13
|
+
`teleport`, in the paywall's `config.ts`; the same paywall runs on both
|
|
14
|
+
sides, so nothing is built twice. Everything about writing the paywall
|
|
15
|
+
itself (routes, hooks, layout, push and publish) is in the
|
|
16
|
+
`superwall-framework` skill; this skill is how to set up teleport well.
|
|
17
|
+
|
|
18
|
+
The framework is headless React: every screen, offer, branch and
|
|
19
|
+
fallback here is code the user owns, so anything they can describe they can
|
|
20
|
+
build. Treat the setup below as the baseline and
|
|
21
|
+
[references/experiments.md](references/experiments.md) as the menu of what
|
|
22
|
+
else is possible; offer from it.
|
|
23
|
+
|
|
24
|
+
These are **today's recommendations** (November 2026). They come from what
|
|
25
|
+
converts so far and may change; when the user's own results disagree, theirs
|
|
26
|
+
win. Say so when you hand a setup over.
|
|
27
|
+
|
|
28
|
+
## The rules
|
|
29
|
+
|
|
30
|
+
1. **Teleport through `teleport.route` in `config.ts`, always.** Name the
|
|
31
|
+
route the web half opens on: `teleport: { route: "plan" }`. A paywall
|
|
32
|
+
with `teleport.route` prepares that teleport and warms the web page the
|
|
33
|
+
moment it opens, asks Apple about Apple Pay at the same time, and
|
|
34
|
+
`superwall push` pre-renders the route so the browser paints it before
|
|
35
|
+
any script runs. A route teleported only with
|
|
36
|
+
`router.push(route, { teleport: true })` gets none of that and opens
|
|
37
|
+
cold. Never hand-build a link or call `openExternalUrl` to reach the web.
|
|
38
|
+
2. **Send only shoppers with Apple Pay to the web.** App to web converts
|
|
39
|
+
well when the shopper pays with a double click; typing a card in a
|
|
40
|
+
browser does not. Read `useApplePay().available` and push the route with
|
|
41
|
+
`{ teleport: applePay.available }`: `true` teleports, `false` pushes the
|
|
42
|
+
same route in the app (`teleport: false` overrides `teleport.route`), so
|
|
43
|
+
the page is still warmed and checked. `false` includes `checking`, the
|
|
44
|
+
first moments before Apple answers; it is cached for the page, and the
|
|
45
|
+
paywall asked when it opened, so by the shopper's tap it has almost
|
|
46
|
+
always answered. Call `await checkApplePay()` instead when a tap must
|
|
47
|
+
wait for the real answer (at most 1.5 s, never `checking`).
|
|
48
|
+
3. **In the app, sell store products; on the web, Stripe products.** The
|
|
49
|
+
route pushed in the app (no Apple Pay) offers the App Store product;
|
|
50
|
+
branch on `useDevice().host` (`"ios-sdk"` or `"android-sdk"` in an
|
|
51
|
+
app, `"web-teleport"` on the teleport page), never on the URL.
|
|
52
|
+
`purchase()` of a Stripe product inside the app teleports: to
|
|
53
|
+
`teleport.route` with the tapped product preselected there
|
|
54
|
+
(`useTeleport().productReference`), or, without `teleport.route`, to
|
|
55
|
+
the route it was tapped on, cold. That is fine as a deliberate path,
|
|
56
|
+
never as a side effect of the in-app branch.
|
|
57
|
+
4. **Map every Stripe product to a store product in `teleport.fallbacks`.**
|
|
58
|
+
While the shopper is in the browser the app shows Superwall's teleport
|
|
59
|
+
screen; `fallbacks` adds "Continue In-App Instead", which buys the store
|
|
60
|
+
product. It is the way back for anyone who changes their mind.
|
|
61
|
+
5. **Use direct Apple Pay, and block prepaid cards:** `checkout: { mode:
|
|
62
|
+
"applePay", prepaidCards: "block" }`. Direct Apple Pay opens Apple's own
|
|
63
|
+
sheet on the tap, a double click and done; it converts better than
|
|
64
|
+
Stripe's embedded card sheet (`"sheet"`), so never pick `"sheet"` for a
|
|
65
|
+
teleport paywall. It is **not available with Stripe Managed Payments**: a
|
|
66
|
+
Managed Payments session can't be paid with Apple Pay directly
|
|
67
|
+
(`useApplePay(product).product.reason` is `session_unsupported`) and the
|
|
68
|
+
shopper gets the card sheet instead. When the account uses Managed
|
|
69
|
+
Payments, tell the user, recommend direct Apple Pay, and let them decide
|
|
70
|
+
whether to set `managedPayments: false` in `checkout` for this paywall
|
|
71
|
+
(they give up Stripe acting as merchant of record on it). Prepaid cards
|
|
72
|
+
are how free trials are abused; `prepaidCards` holds on the card sheet,
|
|
73
|
+
but Apple Pay itself can't be filtered by card type, so also add a Radar
|
|
74
|
+
rule in the Stripe dashboard (see setup).
|
|
75
|
+
6. **A/B test with separate paywalls, not branches in one.** Each variant is
|
|
76
|
+
its own paywall directory with its own `teleport.route`, attached as its
|
|
77
|
+
own variant in a campaign. A flag inside one paywall that decides which
|
|
78
|
+
route teleports loses the preparation, warm-up and pre-render for every
|
|
79
|
+
route but the configured one.
|
|
80
|
+
|
|
81
|
+
## Worked example
|
|
82
|
+
|
|
83
|
+
The `teleport` example (`superwall create --example teleport`) is the full
|
|
84
|
+
flow; this is the shape with the rules above applied. `monthly` and `pro`
|
|
85
|
+
are Stripe products, `annual` the App Store one.
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
// paywalls/web-checkout/config.ts
|
|
89
|
+
import { definePaywall } from "superwall/config";
|
|
90
|
+
|
|
91
|
+
export default definePaywall({
|
|
92
|
+
name: "Web checkout",
|
|
93
|
+
teleport: { route: "plan", fallbacks: { monthly: "annual", pro: "annual" } },
|
|
94
|
+
checkout: { mode: "applePay", prepaidCards: "block" },
|
|
95
|
+
products: {
|
|
96
|
+
monthly: "live:price_MONTHLY:7days-free",
|
|
97
|
+
pro: "live:price_PRO:no-trial",
|
|
98
|
+
annual: "pro_5999_year",
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
// paywalls/web-checkout/app/goal.tsx — in the app
|
|
105
|
+
import { useApplePay } from "superwall/hooks";
|
|
106
|
+
import { useRouter } from "superwall/navigation";
|
|
107
|
+
|
|
108
|
+
export default function Goal() {
|
|
109
|
+
const router = useRouter();
|
|
110
|
+
const applePay = useApplePay();
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<button
|
|
114
|
+
type="button"
|
|
115
|
+
onClick={() => {
|
|
116
|
+
// Apple Pay set up: plan opens in the browser. Otherwise: plan, in the app.
|
|
117
|
+
router.push("plan", { teleport: applePay.available });
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
Continue
|
|
121
|
+
</button>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
// paywalls/web-checkout/app/plan.tsx — on the web, or in the app without Apple Pay
|
|
128
|
+
import { useDevice, useProducts, usePurchase } from "superwall/hooks";
|
|
129
|
+
|
|
130
|
+
export default function Plan() {
|
|
131
|
+
const { host } = useDevice();
|
|
132
|
+
const { getProduct } = useProducts();
|
|
133
|
+
const { purchase } = usePurchase();
|
|
134
|
+
// In an app sell the store product: a Stripe purchase in the iOS app would
|
|
135
|
+
// teleport again, and the Android app can't teleport at all.
|
|
136
|
+
const inApp = host === "ios-sdk" || host === "android-sdk";
|
|
137
|
+
const reference = inApp ? "annual" : "monthly";
|
|
138
|
+
const product = getProduct(reference);
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<button type="button" onClick={() => void purchase(reference)}>
|
|
142
|
+
{product?.variables.price ? `Subscribe for ${product.variables.price}` : "Subscribe"}
|
|
143
|
+
</button>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Where to go next
|
|
149
|
+
|
|
150
|
+
| The job | Read |
|
|
151
|
+
| --- | --- |
|
|
152
|
+
| Set up app to web end to end: prerequisites, the paywall, products, the campaign, verifying on a device | [references/setup.md](references/setup.md) |
|
|
153
|
+
| Setups and experiments: A/B tests by paywall, web prices and discounts, email before the teleport, failure and abandonment rescue, a custom teleport screen, trial eligibility, `completion`, attribution, and more | [references/experiments.md](references/experiments.md) |
|
|
154
|
+
| Anything else about the paywall: routes, `useQueryState`, `useTeleport`, layout, push and publish | the `superwall-framework` skill |
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# Setups and experiments
|
|
2
|
+
|
|
3
|
+
What else an app-to-web flow can do, and what is worth testing. None of
|
|
4
|
+
this is required; [setup.md](setup.md) is the baseline. Read this file as
|
|
5
|
+
a menu of what the framework makes possible, and show the user that range:
|
|
6
|
+
a paywall is the user's own React, and teleport's primitives (the config
|
|
7
|
+
options, `useTeleport`, `usePurchase` callbacks, `useApplePay`,
|
|
8
|
+
`returnToApp({ data })`, `router.push(route, { teleport })`) compose into
|
|
9
|
+
almost any flow they can describe. When they ask for something not listed
|
|
10
|
+
here, build it from those pieces before saying it can't be done.
|
|
11
|
+
|
|
12
|
+
When the user asks for "an experiment" without saying which, start with
|
|
13
|
+
the first A/B test below against their current in-app paywall, and
|
|
14
|
+
suggest two or three others from this file as next steps.
|
|
15
|
+
|
|
16
|
+
Every snippet below is cut from a file that type-checks against the framework. `monthly` and
|
|
17
|
+
`webAnnual` are Stripe products, `annual` and `annualOffer` App Store ones;
|
|
18
|
+
use the user's own references.
|
|
19
|
+
|
|
20
|
+
## A/B tests: one paywall per variant
|
|
21
|
+
|
|
22
|
+
Test teleport variants as separate paywalls, each a variant in the same
|
|
23
|
+
campaign audience, never as a flag inside one paywall. Only the configured
|
|
24
|
+
`teleport.route` is prepared, warmed, Apple Pay-checked and pre-rendered,
|
|
25
|
+
so a branch that teleports another route makes one variant slower and the
|
|
26
|
+
test unfair.
|
|
27
|
+
|
|
28
|
+
Copy the paywall directory, change only what the variant tests, push both,
|
|
29
|
+
and add each as a variant of the campaign audience. Find the endpoints with
|
|
30
|
+
`superwall api docs variant`, and split traffic with `superwall campaigns
|
|
31
|
+
variants weights <campaignId> <audienceId>` (the `superwall` skill's
|
|
32
|
+
`references/api.md`). Changing weights changes live traffic: confirm with
|
|
33
|
+
the user first.
|
|
34
|
+
|
|
35
|
+
Tests worth running, each one paywall directory per arm:
|
|
36
|
+
|
|
37
|
+
| Test | Arm A | Arm B |
|
|
38
|
+
| --- | --- | --- |
|
|
39
|
+
| App to web at all | the current in-app paywall | the same paywall with `teleport` |
|
|
40
|
+
| Which page teleports | `teleport.route` on the plan picker | on the last page |
|
|
41
|
+
| Web price | the same price as the App Store | a lower Stripe price (below) |
|
|
42
|
+
| Trial on the web | `introductoryOfferEligibility: "automatic"` | `"ineligible"` |
|
|
43
|
+
| After paying | `completion: "confirmation"` | `"direct"` |
|
|
44
|
+
| Who teleports | everyone with Apple Pay | only trial-eligible shoppers (below) |
|
|
45
|
+
| Way back | `fallbacks` on the teleport screen | a custom screen with its own offer (below) |
|
|
46
|
+
| Failure rescue | none | back to the app on a decline (below) |
|
|
47
|
+
|
|
48
|
+
## Show the web price beside the App Store's
|
|
49
|
+
|
|
50
|
+
A Stripe product pays no App Store commission, so the web can be cheaper.
|
|
51
|
+
Both products are priced in the app before the teleport; say so on the
|
|
52
|
+
button that teleports:
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
const applePay = useApplePay();
|
|
56
|
+
const { getProduct } = useProducts();
|
|
57
|
+
const store = getProduct("annual")?.variables.price;
|
|
58
|
+
const web = getProduct("webAnnual")?.variables.price;
|
|
59
|
+
|
|
60
|
+
const label = applePay.available
|
|
61
|
+
? web && store ? `${web} a year with Apple Pay (${store} in the App Store)` : "Continue"
|
|
62
|
+
: store ? `${store} a year` : "Continue";
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<button type="button" onClick={() => router.push("plan", { teleport: applePay.available })}>
|
|
66
|
+
{label}
|
|
67
|
+
</button>
|
|
68
|
+
);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Without Apple Pay the same button stays in the app and names the App Store
|
|
72
|
+
price, so every shopper still has a way forward.
|
|
73
|
+
|
|
74
|
+
Never write a price into code or copy; both come from the stores.
|
|
75
|
+
|
|
76
|
+
## Who teleports
|
|
77
|
+
|
|
78
|
+
The `teleport` option on a push is any boolean, so the gate can be more
|
|
79
|
+
than Apple Pay. Teleport only shoppers who can still take the trial, for
|
|
80
|
+
example:
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
const applePay = useApplePay();
|
|
84
|
+
const { eligible } = useIntroductoryOffer();
|
|
85
|
+
const teleport = applePay.available && eligible === true;
|
|
86
|
+
|
|
87
|
+
<button type="button" onClick={() => router.push("plan", { teleport })}>Continue</button>;
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The same works for a user attribute (`useUserAttribute`), a quiz answer in
|
|
91
|
+
`useQueryState`, or the locale. Keep Apple Pay in every gate.
|
|
92
|
+
|
|
93
|
+
## Ask for the email in the app
|
|
94
|
+
|
|
95
|
+
A `user.email` becomes the Stripe customer's email, and the teleport page
|
|
96
|
+
takes the email the app sent, so asking for it before the teleport saves
|
|
97
|
+
the shopper typing it in the browser and lets the user follow up when a
|
|
98
|
+
web payment never happens:
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
const applePay = useApplePay();
|
|
102
|
+
const [email, setEmail] = useUserAttribute("email");
|
|
103
|
+
|
|
104
|
+
<input type="email" value={email ?? ""} onChange={(event) => void setEmail(event.target.value)} />;
|
|
105
|
+
<button type="button" onClick={() => router.push("plan", { teleport: applePay.available })}>
|
|
106
|
+
Continue
|
|
107
|
+
</button>;
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Promotion codes on the web
|
|
111
|
+
|
|
112
|
+
`useDiscount()` redeems a Stripe promotion code and prices every product
|
|
113
|
+
with it:
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
const { redeem, applied, getDiscountedProduct } = useDiscount();
|
|
117
|
+
const { purchase } = usePurchase();
|
|
118
|
+
const [code, setCode] = React.useState("");
|
|
119
|
+
const deal = applied ? getDiscountedProduct("webAnnual") : undefined;
|
|
120
|
+
|
|
121
|
+
<input value={code} onChange={(event) => setCode(event.target.value)} />;
|
|
122
|
+
<button type="button" onClick={() => void redeem(code)}>Apply</button>;
|
|
123
|
+
<button type="button" onClick={() => void purchase("webAnnual")}>
|
|
124
|
+
{deal?.applies ? `${deal.discountedPrice} (was ${deal.price})` : "Subscribe"}
|
|
125
|
+
</button>;
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`redeem(code)` resolves with the verdict; `useDiscount({ onDropped })`
|
|
129
|
+
fires when checkout later refuses a code.
|
|
130
|
+
|
|
131
|
+
## Rescue a failed payment
|
|
132
|
+
|
|
133
|
+
`usePurchase({ onFailure })` says why a web payment failed
|
|
134
|
+
(`failure.reason`: `card_declined`, `insufficient_funds`, `expired_card`,
|
|
135
|
+
`incorrect_card_details`, `authentication_failed`, `card_not_supported`,
|
|
136
|
+
`limit_exceeded`, `fraud_suspected`, `processing_error`, `unknown`). Each
|
|
137
|
+
reason can get its own answer: a cheaper plan on the page, or back to the
|
|
138
|
+
app for the App Store:
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
// the teleport route, on the web
|
|
142
|
+
const teleport = useTeleport();
|
|
143
|
+
const [cheaper, setCheaper] = React.useState(false);
|
|
144
|
+
const { purchase } = usePurchase({
|
|
145
|
+
onFailure: (failure) => {
|
|
146
|
+
if (teleport.status !== "arrived") return;
|
|
147
|
+
if (failure.reason === "insufficient_funds") setCheaper(true);
|
|
148
|
+
else if (failure.reason === "card_declined") void teleport.returnToApp({ data: { offer: "app_store" } });
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
const reference = cheaper ? "monthly" : "webAnnual";
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
In the app, `useTeleport()` reads what came back while `status ===
|
|
155
|
+
"waiting"`:
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
// the route before it, in the app
|
|
159
|
+
const back = useTeleport({ onReturnData: (data) => console.info("back from the page", data) });
|
|
160
|
+
const offer = back.status === "waiting" ? back.data?.offer : undefined;
|
|
161
|
+
const failure = back.status === "waiting" ? back.failure : undefined;
|
|
162
|
+
// offer === "app_store": show purchase("annual"); failure: say what happened
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
`returnToApp()` resolves `"opened"`, `"cancelled"` (the shopper tapped
|
|
166
|
+
Cancel on "Open in App?") or `"no_app"`; on anything but `"opened"` they
|
|
167
|
+
are still on the page, so leave it ready to buy again. The data is plain
|
|
168
|
+
JSON, at most 16 KB.
|
|
169
|
+
|
|
170
|
+
## An offer when the shopper gives up
|
|
171
|
+
|
|
172
|
+
In the app, `useTeleport({ onCancel })` fires when the shopper cancels on
|
|
173
|
+
the teleport screen. Answer with an in-app offer, an App Store product at
|
|
174
|
+
an introductory price, on a route of its own:
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
// in the app
|
|
178
|
+
const router = useRouter();
|
|
179
|
+
const { customPlacement } = useActions();
|
|
180
|
+
useTeleport({
|
|
181
|
+
onCancel: () => {
|
|
182
|
+
customPlacement("teleport_cancelled");
|
|
183
|
+
router.push("offer", { teleport: false });
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
// app/offer.tsx
|
|
190
|
+
const price = getProduct("annualOffer")?.variables.price;
|
|
191
|
+
|
|
192
|
+
<button type="button" onClick={() => void purchase("annualOffer")}>
|
|
193
|
+
{price ? `Stay in the app: ${price} for the first year` : "Stay in the app"}
|
|
194
|
+
</button>;
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
`customPlacement(name)` fires a placement the SDK reports like any other,
|
|
198
|
+
so the user can count it, and aim a campaign at it, in the dashboard.
|
|
199
|
+
`useTeleport({ onOpen, onReturn, onComplete })` are there for the other
|
|
200
|
+
moments; an unpaid return resolves the `purchase()` as `abandoned`.
|
|
201
|
+
|
|
202
|
+
## Your own teleport screen
|
|
203
|
+
|
|
204
|
+
`teleport.overlay: false` hides Superwall's teleport screen; draw your own
|
|
205
|
+
from `useTeleport()` while `status === "waiting"` and not `returned`. Its
|
|
206
|
+
copy, its offer and its look are all yours:
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
export function WaitingScreen() {
|
|
210
|
+
const teleport = useTeleport();
|
|
211
|
+
const { getProduct } = useProducts();
|
|
212
|
+
const { purchase } = usePurchase();
|
|
213
|
+
if (teleport.status !== "waiting" || teleport.returned) return null;
|
|
214
|
+
const fallback = teleport.fallbackReference;
|
|
215
|
+
const price = fallback ? getProduct(fallback)?.variables.price : undefined;
|
|
216
|
+
|
|
217
|
+
return (
|
|
218
|
+
<div role="dialog">
|
|
219
|
+
<p>Finish in Safari. Your plan is waiting there.</p>
|
|
220
|
+
<button type="button" onClick={teleport.open}>Open Safari again</button>
|
|
221
|
+
{fallback && price ? (
|
|
222
|
+
<button type="button" onClick={() => void purchase(fallback)}>
|
|
223
|
+
Pay {price} in the app instead
|
|
224
|
+
</button>
|
|
225
|
+
) : null}
|
|
226
|
+
<button type="button" onClick={teleport.cancel}>Not now</button>
|
|
227
|
+
</div>
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
`fallbackReference` is the `teleport.fallbacks` product for what is being
|
|
233
|
+
bought. Render it from the layout so it covers every page. Keep the default
|
|
234
|
+
screen unless the user wants their own; it already does all of this.
|
|
235
|
+
|
|
236
|
+
## An Apple Pay button on the web page
|
|
237
|
+
|
|
238
|
+
`useApplePay(product).product` says whether Apple's sheet will open for
|
|
239
|
+
that product, so the web page can promise it:
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
const applePay = useApplePay("webAnnual");
|
|
243
|
+
|
|
244
|
+
<button type="button" onClick={() => void purchase("webAnnual")}>
|
|
245
|
+
{applePay.product.status === "ready" ? "Pay with Apple Pay" : "Continue to payment"}
|
|
246
|
+
</button>;
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## After the payment: `completion`
|
|
250
|
+
|
|
251
|
+
`teleport.completion` decides what the web page does once paid:
|
|
252
|
+
`"confirmation"` (the default) shows "You're all set" with Return to App;
|
|
253
|
+
`"direct"` opens the app at once and shows that screen only when the app
|
|
254
|
+
didn't open. Worth testing when shoppers stay on the page after paying.
|
|
255
|
+
|
|
256
|
+
## The trial on the web: `introductoryOfferEligibility`
|
|
257
|
+
|
|
258
|
+
The App Store's trial history doesn't bind a Stripe purchase, so the web
|
|
259
|
+
checkout decides on its own: `teleport.introductoryOfferEligibility` is
|
|
260
|
+
`"automatic"` (the app's store says the shopper is eligible, the default),
|
|
261
|
+
`"eligible"` (always offer it) or `"ineligible"` (never). The Stripe
|
|
262
|
+
product's offer (`7days-free`, `no-trial`) sets which trial it is.
|
|
263
|
+
|
|
264
|
+
## Tag the purchase for analysis
|
|
265
|
+
|
|
266
|
+
`purchase(reference, { stripeMetadata })` writes key/values onto the
|
|
267
|
+
Stripe subscription, visible in Stripe and its webhooks; tag the arm so
|
|
268
|
+
revenue joins the experiment:
|
|
269
|
+
|
|
270
|
+
```tsx
|
|
271
|
+
const teleport = useTeleport();
|
|
272
|
+
const tapped = teleport.status === "arrived" ? teleport.productReference : undefined;
|
|
273
|
+
const reference = tapped ?? "webAnnual";
|
|
274
|
+
|
|
275
|
+
<button
|
|
276
|
+
type="button"
|
|
277
|
+
onClick={() => void purchase(reference, { stripeMetadata: { experiment: "teleport-early", variant: "b" } })}
|
|
278
|
+
>
|
|
279
|
+
Subscribe
|
|
280
|
+
</button>;
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
`teleport.productReference` is the Stripe product tapped in the app when a
|
|
284
|
+
`purchase()` started the teleport; preselect it.
|
|
285
|
+
|
|
286
|
+
## Two ways into the web
|
|
287
|
+
|
|
288
|
+
When a paywall teleports from more than one page, keep the main one as
|
|
289
|
+
`teleport.route` and prepare the other with `useTeleport().prefetch(route)`
|
|
290
|
+
as soon as it can be reached, so it opens warm too:
|
|
291
|
+
|
|
292
|
+
```tsx
|
|
293
|
+
const applePay = useApplePay();
|
|
294
|
+
const { prefetch } = useTeleport();
|
|
295
|
+
React.useEffect(() => prefetch("checkout"), [prefetch]);
|
|
296
|
+
|
|
297
|
+
<button type="button" onClick={() => router.push("checkout", { teleport: applePay.available })}>
|
|
298
|
+
Checkout
|
|
299
|
+
</button>;
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
The second page keeps the same Apple Pay gate as the first.
|
|
303
|
+
|
|
304
|
+
## Leaving the web page without paying
|
|
305
|
+
|
|
306
|
+
On the first web route, `router.back()` and `close()` return to the app.
|
|
307
|
+
The teleport screen's Continue In-App Instead buys the `teleport.fallbacks`
|
|
308
|
+
product.
|
|
309
|
+
|
|
310
|
+
## A Stripe purchase in the app
|
|
311
|
+
|
|
312
|
+
`purchase()` of a Stripe product inside the app teleports: to
|
|
313
|
+
`teleport.route` with that product preselected
|
|
314
|
+
(`useTeleport().productReference` on the page), or, without
|
|
315
|
+
`teleport.route`, to the route it was tapped on, which is not warmed.
|
|
316
|
+
Without `teleport` in config at all, it opens Superwall's hosted checkout
|
|
317
|
+
in the browser instead, the older app-to-web path. Prefer pushing
|
|
318
|
+
`teleport.route` behind the Apple Pay gate; use a Stripe purchase in the
|
|
319
|
+
app when that preselection is the point.
|
|
320
|
+
|
|
321
|
+
## And everything else
|
|
322
|
+
|
|
323
|
+
The web page is the same paywall, so the rest of the framework applies on
|
|
324
|
+
both sides: transitions and motion, Rive, layouts and themes, localized
|
|
325
|
+
copy, haptics in the app, `useQueryState` answers carried across the
|
|
326
|
+
teleport, quizzes and onboarding before the paywall, trial reminders. Any
|
|
327
|
+
of them can be an arm of a test. Pick by what the user wants to learn, and
|
|
328
|
+
keep one change per arm.
|