@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
|
@@ -13,6 +13,11 @@ superwall migrate --screen App/UpdateRequiredView.swift # in the app's root
|
|
|
13
13
|
superwall migrate --screen # scan for likely screens and pick
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
Add `--dry-run` to preview first: it reads the screen, prints the
|
|
17
|
+
`paywalls/<slug>` it would create and ends with "Dry run - no changes
|
|
18
|
+
made." without writing a file, prompting for a screenshot or starting the
|
|
19
|
+
agent or the studio.
|
|
20
|
+
|
|
16
21
|
The scan reads that one file — SwiftUI or UIKit (`.swift`), Jetpack Compose or
|
|
17
22
|
Android Views (`.kt`), React Native (`.tsx`), Flutter (`.dart`) — and writes into the project it finds (or a
|
|
18
23
|
new `superwall/`):
|
|
@@ -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.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Set up app to web
|
|
2
|
+
|
|
3
|
+
The playbook for "set up an app-to-web flow" or "an app-to-web experiment".
|
|
4
|
+
Do every step; each ends with how to tell it worked. The recommendations are
|
|
5
|
+
today's (November 2026) and may change. The `superwall-framework` skill
|
|
6
|
+
covers everything about writing the paywall; this file only adds what
|
|
7
|
+
teleport needs.
|
|
8
|
+
|
|
9
|
+
## Checklist
|
|
10
|
+
|
|
11
|
+
- [ ] 1. Prerequisites hold (SDK, web paywall domain, Stripe, app links)
|
|
12
|
+
- [ ] 2. Products: Stripe products for the web, a store product for each fallback
|
|
13
|
+
- [ ] 3. `config.ts`: `teleport.route`, `fallbacks`, direct Apple Pay with prepaid cards blocked
|
|
14
|
+
- [ ] 4. The Apple Pay gate on the push that reaches `teleport.route`
|
|
15
|
+
- [ ] 5. The teleport route sells Stripe on the web and the store in the app
|
|
16
|
+
- [ ] 6. Prepaid cards blocked in Stripe Radar too
|
|
17
|
+
- [ ] 7. Pushed, verified on an iPhone, attached to a campaign
|
|
18
|
+
|
|
19
|
+
## 1. Prerequisites
|
|
20
|
+
|
|
21
|
+
- **SuperwallKit 4.18.0 or later** in the iOS app. On an older SDK, and on
|
|
22
|
+
Android, teleport doesn't run: the route opens in the app and a Stripe
|
|
23
|
+
purchase goes to Superwall's hosted checkout. Read the version from the
|
|
24
|
+
app's package manager, never assume it.
|
|
25
|
+
- **A web paywall domain and Stripe connected** on the Superwall app the
|
|
26
|
+
paywall is pushed to: the teleport page opens on that domain, and Stripe
|
|
27
|
+
takes the payment. Both are dashboard settings; when either is missing,
|
|
28
|
+
say so and stop, the user sets them up.
|
|
29
|
+
- **A way back to the app:** its universal link (associated domains), its
|
|
30
|
+
URL scheme, or both. The framework picks the link; `no_app` from
|
|
31
|
+
`returnToApp()` means neither is set.
|
|
32
|
+
|
|
33
|
+
## 2. Products
|
|
34
|
+
|
|
35
|
+
Stripe products (`{environment}:{priceId}:{offer}`, such as
|
|
36
|
+
`live:price_123:7days-free`) are what the web page sells. Give each one a
|
|
37
|
+
store product to fall back to in the app. Never hardcode a price: the stores
|
|
38
|
+
price them at runtime. Create what's missing with `superwall products
|
|
39
|
+
create` (the `superwall-framework` skill's `references/cli.md`); list first.
|
|
40
|
+
|
|
41
|
+
## 3. `config.ts`
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { definePaywall } from "superwall/config";
|
|
45
|
+
|
|
46
|
+
export default definePaywall({
|
|
47
|
+
name: "Web checkout",
|
|
48
|
+
teleport: {
|
|
49
|
+
route: "plan", // the web half opens here; prepared, warmed and pre-rendered
|
|
50
|
+
fallbacks: { monthly: "annual" }, // "Continue In-App Instead" on the teleport screen
|
|
51
|
+
},
|
|
52
|
+
checkout: { mode: "applePay", prepaidCards: "block" },
|
|
53
|
+
products: { monthly: "live:price_MONTHLY:7days-free", annual: "pro_5999_year" },
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- `route` is required by this playbook even though the type makes it
|
|
58
|
+
optional: it is what makes the browser open at once.
|
|
59
|
+
- `checkout` only applies to the web half here: inside the iOS app a
|
|
60
|
+
purchase never uses it. `"applePay"` is direct Apple Pay: Apple's sheet
|
|
61
|
+
opens on the tap, and Stripe's card sheet is only the fallback where
|
|
62
|
+
Apple Pay can't open. Always use it on a teleport paywall; `"sheet"`
|
|
63
|
+
(Stripe's embedded checkout) makes every shopper start from a card form.
|
|
64
|
+
A teleport page left without `checkout` uses `"applePay"` too, but write
|
|
65
|
+
it so `prepaidCards` has a place.
|
|
66
|
+
- **Stripe Managed Payments:** direct Apple Pay is not available with it.
|
|
67
|
+
A Managed Payments checkout session comes back as Stripe's embedded
|
|
68
|
+
checkout, so `useApplePay(product).product` reads `session_unsupported`
|
|
69
|
+
and the tap opens the card sheet. Ask the user whether their Stripe
|
|
70
|
+
account uses Managed Payments; when it does, recommend direct Apple Pay
|
|
71
|
+
and let them choose `checkout: { mode: "applePay", managedPayments:
|
|
72
|
+
false, prepaidCards: "block" }` for this paywall (Stripe stops acting as
|
|
73
|
+
merchant of record on it). Their call, not yours.
|
|
74
|
+
- Leave `completion` (`"confirmation"`) and `introductoryOfferEligibility`
|
|
75
|
+
(`"automatic"`) at their defaults unless the user is testing them
|
|
76
|
+
([experiments.md](experiments.md)).
|
|
77
|
+
|
|
78
|
+
## 4. The Apple Pay gate
|
|
79
|
+
|
|
80
|
+
The push that reaches `teleport.route` decides whether the shopper goes to
|
|
81
|
+
the web:
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
const applePay = useApplePay();
|
|
85
|
+
router.push("plan", { teleport: applePay.available });
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`available` is Apple's own card check
|
|
89
|
+
(`ApplePaySession.canMakePaymentsWithActiveCard`), the same in the iOS
|
|
90
|
+
app's web view as in a browser; on Android it is `false`
|
|
91
|
+
(`unsupported_browser`), where teleport doesn't run anyway. The answer is
|
|
92
|
+
asked when the paywall opens and cached for the page; an error or a timeout
|
|
93
|
+
is asked again. A tap that must wait for the answer uses
|
|
94
|
+
`const { available } = await checkApplePay()` instead.
|
|
95
|
+
|
|
96
|
+
Verify: in the studio (Chrome) `useApplePay()` reads `false,
|
|
97
|
+
unsupported_browser`, so the push stays in the app. That is expected; the
|
|
98
|
+
teleport itself only runs on an iPhone (step 7).
|
|
99
|
+
|
|
100
|
+
## 5. The teleport route
|
|
101
|
+
|
|
102
|
+
The route runs in two places: on the web page after a teleport, and in the
|
|
103
|
+
app for shoppers without Apple Pay. Branch on `useDevice().host`:
|
|
104
|
+
|
|
105
|
+
- `"ios-sdk"` or `"android-sdk"`: sell the store product. A Stripe
|
|
106
|
+
`purchase()` in the iOS app would teleport again, and the Android app
|
|
107
|
+
can't teleport, so it would open hosted checkout instead.
|
|
108
|
+
- anything else (`"web-teleport"` on the teleport page): sell the Stripe
|
|
109
|
+
product, preselecting `useTeleport().productReference` when the app
|
|
110
|
+
passed one.
|
|
111
|
+
|
|
112
|
+
Keep the first render of the route to what the pre-render knows (locale,
|
|
113
|
+
products and prices, trial, `productReference`); the `superwall-framework`
|
|
114
|
+
skill's teleport rule lists the details.
|
|
115
|
+
|
|
116
|
+
## 6. Prepaid cards in Stripe
|
|
117
|
+
|
|
118
|
+
`prepaidCards: "block"` refuses prepaid cards on Stripe's card sheet and
|
|
119
|
+
hosted checkout. An Apple Pay payment can't be filtered by card type from
|
|
120
|
+
the paywall, so also ask the user to add a rule in the Stripe dashboard
|
|
121
|
+
(Radar → Rules): `Block if :card_funding: = 'prepaid'`, and to check it
|
|
122
|
+
in test mode. That is a person's step; list it in the hand-over.
|
|
123
|
+
|
|
124
|
+
## 7. Push, verify, attach
|
|
125
|
+
|
|
126
|
+
1. `superwall push`, then fix every pre-render warning it prints for the
|
|
127
|
+
teleport route (the page would render in the browser instead).
|
|
128
|
+
2. On an iPhone with a card in Wallet, open the paywall from the app (the
|
|
129
|
+
SDK's debugger, or its placement), tap through to `plan`: the browser
|
|
130
|
+
opens on the plan, Apple Pay pays, "You're all set", Return to App, and
|
|
131
|
+
the app is unlocked.
|
|
132
|
+
3. On an iPhone or simulator with an empty Wallet, the same tap opens
|
|
133
|
+
`plan` in the app with the store product.
|
|
134
|
+
4. On the web page, the pay button opens Apple's sheet straight away, not
|
|
135
|
+
a card form. A card form means `"sheet"` mode or Managed Payments
|
|
136
|
+
(step 3).
|
|
137
|
+
5. In the browser, cancel the payment and use Continue In-App Instead on
|
|
138
|
+
the teleport screen: the store sheet opens for the fallback.
|
|
139
|
+
6. `superwall promote` (or `publish`), then attach the paywall to its
|
|
140
|
+
campaign (the `superwall` skill's dashboard workflow). For an
|
|
141
|
+
experiment, each variant is its own paywall: see
|
|
142
|
+
[experiments.md](experiments.md#ab-tests-one-paywall-per-variant).
|
|
143
|
+
|
|
144
|
+
## Pitfalls
|
|
145
|
+
|
|
146
|
+
- Teleporting a route other than `teleport.route` with
|
|
147
|
+
`router.push(route, { teleport: true })`: it opens cold. Make it the
|
|
148
|
+
route, or call `useTeleport().prefetch(route)` when it must stay
|
|
149
|
+
another one.
|
|
150
|
+
- Reading `useApplePay()?.available`: it is always defined; read it
|
|
151
|
+
without `?.`. `useVariables().device.isApplePayAvailable` is deprecated
|
|
152
|
+
and always `true` in the app.
|
|
153
|
+
- Answers kept in component state are lost on the web: keep what the web
|
|
154
|
+
half needs in `useQueryState`, which the teleport carries along.
|
|
155
|
+
- Returning to the app with `openDeepLink` or a hand-built link: use
|
|
156
|
+
`useTeleport().returnToApp()`, or `close()` / `router.back()` on the
|
|
157
|
+
first web route.
|