Skip to content

6.1.0

Choose a tag to compare

@kherembourg kherembourg released this 04 Sep 20:32
· 1 commit to master since this release

Purchasely Android SDK 6.1.0

6.1.0 is an additive release. There are no breaking changes, so an existing integration needs no code change.

The main feature is Web2App: your app now knows the result of a web subscription redemption, and can draw its own result screen.

🔗 Web-to-app funnels (redemption)

A user buys a subscription on your website, taps the link in the confirmation email, and lands in your app. The SDK now tells your app when the redemption settles.

Purchasely.Builder(applicationContext)
    .apiKey("your-api-key")
    .stores(listOf(GoogleStore()))
    .webRedemptionListener(appHandlesRedemptionAlert = false) { result ->
        when (result) {
            // `replay` is a re-tap of a link already redeemed. Unlock, but do not
            // thank the user twice.
            is PLYWebRedemptionResult.Success -> unlockContent(result.context, result.replay)
            is PLYWebRedemptionResult.Failure -> showError(result.errorMessage)
        }
    }
    .build()
    .start()

Your listener receives onRedemptionCompleted(result) on the main thread, exactly once per settled redemption. The result carries the outcome and what the redemption granted, so you can unlock the content immediately.

  • appHandlesRedemptionAlert = false (default): the SDK shows its own success or failure popin, then calls your listener when the user closes it.
  • appHandlesRedemptionAlert = true: the SDK shows no popin. Your listener receives the result as soon as the redemption settles, and your app owns the full post-redemption experience.

The listener is available on the builder only, because a redemption can settle during start(). The SDK holds it until Purchasely.close(), so do not let it capture an Activity.

PLYWebRedemptionResult is a sealed class with two cases:

  • Success(context, replay)context describes what the redemption granted, and its subscription carries the redeemed subscription when the server sent one. replay is true when the user taps a link that was already redeemed.
  • Failure(errorCode, errorMessage) — the server-provided code and message.

User attributes from the web funnel. A successful redemption can restore the built-in and custom user attributes of the web purchase. The SDK applies them before the entitlements refresh, so every later event and every audience already sees them. Read them with the getters you already use.

Three notes:

  • A redemption deeplink does not obey allowDeeplink. A user who taps the link in the email always gets the subscription.
  • When a link has expired, errorMessage can contain a masked email address, for example j***@example.com. Show it to the user. Do not send it to your analytics.
  • The redemption token never enters a log line, an analytics event, or the deeplink waiting list. Deduplication uses a SHA-256 hash of the token.

Two new analytics events: REDEMPTION_CONSUMED and REDEMPTION_FAILED. The SDK also sends the consumed event when the user taps an already redeemed link. A replay is a success, and the replay flag tells the two apart. Add the two cases if your app switches over the event type.

Read an event payload with event.properties.toMap(). The redemption payload types are opaque on purpose, so do not read their fields directly.

Documentation: Web-to-app funnels (redemption)

Also in this release

  • Set the anonymous user id yourself. anonymousUserId(id, override) on the builder gives the SDK the java.util.UUID your app already uses. The SDK keeps an id that is already on the device, unless you pass override = true. The SDK stores the id you pass in uppercase, and an id it generates itself in lowercase, so compare an anonymous user id case-insensitively.
  • API proxy for restricted regions. proxy(api) routes the API traffic through your own https URL, for a region where api.purchasely.io is not reachable. The paywall and the tracking hosts stay on production. proxy(api = null) clears a proxy that an earlier build() set.

Fixes

  • start() always invokes its callback, exactly once. A configure() that returned early no longer leaves the callback pending.
  • An inline PLYPresentationView no longer restores another paywall's state after a configuration change. A banner could render the full-screen paywall inside its banner-sized slot.
  • A screen that is re-attached no longer reports a second PRESENTATION_VIEWED.
  • Every handleDeeplink() of a session works. The consumed marker is scoped to the intent that carried the URL, so it no longer swallows every deeplink after the first one.
  • The redemption outcome alert reports to your listener when the user dismisses it.

Full list of the changes: docs.purchasely.com/changelog