Purchases & Effects
What a native funnel session yields — effects, the store purchase path, attributes, dismissal, and resume.
A running session answers every interaction with a step: the screen to draw
plus the effects the host must act on. The effect vocabulary lives in one
place — FunnelEffect in librovenue.udl
(packages/core-rs/src/librovenue.udl:351-360): Dismiss, OpenUrl,
ShowAlert, Custom, Purchase, and RestorePurchases. Navigation,
variables and visibility are the machine's own business and produce no
effect (packages/funnel-core-rs/src/actions.rs:146-147).
Buying: purchase_selected and restore_purchases
An authored purchase_selected action means the funnel waits on the store
(packages/funnel-core-rs/src/actions.rs:126-129). It surfaces to the host
as a Purchase effect carrying the selected package id; restore_purchases
surfaces as RestorePurchases
(packages/funnel-core-rs/src/actions.rs:170-179). The host completes both
through the SDK's normal store purchase path — purchase alongside
restorePurchases on every SDK
(packages/sdk-swift/Sources/Rovenue/Rovenue.swift:835,
packages/sdk-swift/Sources/Rovenue/Rovenue.swift:888,
packages/sdk-kotlin/src/main/kotlin/dev/rovenue/sdk/Rovenue.kt:737,
packages/sdk-kotlin/src/main/kotlin/dev/rovenue/sdk/Rovenue.kt:801,
packages/sdk-rn/src/index.ts:54,
packages/sdk-flutter/rovenue_flutter/lib/src/rovenue.dart:176,
packages/sdk-flutter/rovenue_flutter/lib/src/rovenue.dart:196).
A purchase with nothing selected produces no effect at all — there is
nothing to buy, and the screen's purchase button is disabled in that state
(packages/funnel-core-rs/src/actions.rs:170-173). The purchase the host
then makes carries the funnel's attribution snapshot, so revenue lands on
the placement, funnel and variant that converted the subscriber: without it
a purchase made inside a funnel lands unattributed and nothing errors
(packages/core-rs/src/librovenue.udl:164-167).
A control that buys produces no Purchase either while the selected
package's store price is missing: it is disabled while the price loads, and
once the lookup failed it reads "Try again" and yields RetryPrices instead
(packages/core-rs/src/librovenue.udl:591-594), which the SDK's driver
answers by asking the store again — see
Store prices. A control that would buy a
package whose purchase is still pending is refused the same way; see
A pending purchase.
While a presented funnel waits on the store, whether the SDK buys or your
onPurchase / onRestore does, the tapped control spins, the rest of the
page dims and ignores touch, and an authored purchase overlay covers it. See
While a purchase runs.
An embedded RovenueFunnelView does not show this; it is up to your app.
Win-back offers
{"type": "purchase_selected", "offer": "win_back"} — or a purchase button
with "offer": "win_back" (the inspector's On tap → Use win-back offer when
eligible) — buys the selected package with its best eligible win-back
offer: the Purchase effect then
carries winBackOfferId, and the SDK buys with purchase(…, winBackOfferId:)
(App Store iOS 18+; Google Play offers tagged rovenue-winback). With no
eligible offer the effect carries none and the package is bought at its
regular price; an SDK older than this field ignores it and does the same.
The action is native-only (ACTION_NOT_ON_TARGET on the web); converting a
funnel to the web turns it into a plain checkout. Which packages have an
offer reaches the funnel with their store prices, so
product.has_winback / {{product.winback_price}} can show the offer first.
If your app answers purchases itself, set onWinBackPurchase(packageId, winBackOfferId) beside onPurchase (Swift, Kotlin) to receive the offer id;
with only onPurchase the win-back tap arrives as a plain purchase. React
Native's onPurchase receives winBackOfferId as an optional second argument.
Flutter: set onWinBackPurchase(packageId, winBackOfferId) beside onPurchase
on FunnelPresentHandlers or RovenueFunnelView; without it onPurchase
gets the package and buys at the regular price. On Android the visitor is
eligible only when Rovenue saw them hold that Play subscription and no longer
hold it, so product.has_winback and eligibleWinBackOffers agree. See
Win-back offers.
Offer codes: redeem_offer_code
redeem_offer_code surfaces as the RedeemOfferCode effect, which the SDK's
driver answers itself — no host handler: the App Store's offer-code sheet on
iOS, Google Play's redeem page on Android. Nothing reports back, so the chain
moves on at once and nothing on the page waits or dims; a redeemed code
reaches the SDK as a purchase. The judge refuses it on a page that advances
on a timer (it opens a store sheet) and on web funnels. An SDK that predates
the action decodes it as unknown and skips it. See
Store messages and offer codes.
set_attribute never reaches the host
SetAttribute is deliberately absent from the effect enum: librovenue
intercepts it and routes it into the existing attributes module, so it is
never implemented three times
(packages/core-rs/src/librovenue.udl:348-350,
packages/core-rs/src/funnel/session.rs:18). Inside the session the step
converter absorbs it — recorded for the owning core to flush through its
attributes path — while every other effect is forwarded to the host
(packages/core-rs/src/funnel/session.rs:316-322).
Ending: close_funnel and dismiss()
An authored close_funnel action means the funnel is over
(packages/funnel-core-rs/src/actions.rs:124-126); it surfaces as the
Dismiss effect (packages/funnel-core-rs/src/actions.rs:151). The host
side is dismiss(): the façade calls it when the host closes the view or
on a Dismiss effect, and it emits funnel_dismiss — once only, so a close
handler firing twice never double-counts the dismissal
(packages/core-rs/src/funnel/session.rs:421-427).
Video sound and audio sessions
A funnel video is muted unless it sets muted: false. Sounds a funnel plays with play_sound and haptics are separate from that. How each platform treats the audio:
iOS.
play_soundstays on the ambient audio category: it respects the silent switch and mixes with other apps' audio.- An unmuted video is different. While it plays, the funnel takes the playback category, the one a video player uses, so the video is heard through the silent switch, and audio from other apps stops. The funnel restores the category it found when the video ends, pauses or is muted, or when the visitor leaves the screen or the funnel. If the host app changed the category in the meantime, nothing is restored.
- A funnel sound that plays during the video plays under the playback category. The category is given back only after both the video and the sound have finished.
- A phone call, Siri or any other audio interruption pauses the video. When the interruption ends it resumes only if the system says it should; otherwise it stays paused with a visible paused state until the visitor taps it. An interruption is not a stall: it never releases a held Continue and never runs On end.
Android.
- The video plays as media (
USAGE_MEDIA, movie content) and asks for transient audio focus when it starts, giving it back when it ends, pauses or detaches. - When focus is lost, even briefly, the video is muted, not paused, and unmuted when focus returns. Pausing would look like a stall to the 10-second stall watchdog, which would release a held Continue and run On end while the visitor is on a call. Ducking is left to the system.
Web.
- A browser plays sound only after the visitor has interacted with the page. The funnel tries to play the video unmuted. If the browser refuses, the video plays muted and a 32 px badge with a speaker-off glyph (white on 40% black, 8 px in from the top end corner) appears; a tap unmutes the video and removes the badge.
- With
autoplay: falsethe visitor's tap on the video is the interaction, so it starts with sound.
Reduced motion and Low Power mode are unchanged: only a looping video is replaced by its poster.
Resume: state_json restores and re-emits nothing
state_json() persists the session — machine state plus the presentation id
(packages/core-rs/src/funnel/session.rs:404-416). The host stores the
string and hands it back to open_funnel as restored_state_json
(packages/core-rs/src/librovenue.udl:373-376). A fresh open emits
funnel_view plus funnel_screen_view for the first screen; a restored
open emits nothing and keeps the stored presentation id, so the resumed
session counts once
(packages/core-rs/src/librovenue.udl:258-263,
packages/core-rs/src/funnel/session.rs:186-192).
Restore seeds the emission tracking where the restored machine stands: the
first post-restore step does not re-emit the arrival it resumes on, and an
already-finished machine does not emit a completion for a funnel that ended
before this wave (packages/core-rs/src/funnel/session.rs:237-248). A
stored session recorded against a different funnel or revision is discarded
rather than replayed, so handing back a stale one is safe
(packages/sdk-swift/Sources/Rovenue/FunnelUI/ResolvedFunnel.swift:15-17).
Garbage degrades to fresh; a pre-wave bare machine state still restores,
with a fresh id
(packages/core-rs/src/funnel/session.rs:452-466).
The device wire names are funnel_view, funnel_screen_view,
funnel_complete and funnel_dismiss — a closed list; any other
funnel_<x> stays outside the session vocabulary
(apps/api/src/lib/funnel-event-shape.ts:86-91).
Present a Funnel
Open a native funnel the way the editor says — full screen, modal or sheet — with the SDK buying for you, and get one result back.
Preview Drafts in Your App
A debug build with your project's Sandbox key shows each native funnel's latest draft at its placement — no publish, live refresh, nothing recorded.