purchases-android icon indicating copy to clipboard operation
purchases-android copied to clipboard

Android paywall custom package tag

Open simonmitchell opened this issue 1 year ago • 4 comments

Checklist

  • [ ] If applicable, unit tests
  • [ ] If applicable, create follow-up issues for purchases-ios and hybrids

Motivation

This is motivated by a need for us to provide discount offers to our users whilst also using the revenuecat footer UI. We run our offer codes using specifically tagged SubscriptionOption like so:

rcPackage.product.subscriptionOptions?.withTag(offerCode)?.getOrNull(0)

without this change to allow overriding the SubscriptionOption the user is purchasing using the footer component, we cannot apply offer codes in our custom paywall implementation.

Description

A new interface has been added to the ui package called SubscriptionOptionProvider with a single function:

fun subscriptionOption(rcPackage: Package): SubscriptionOption?

This provider can be provided to the library via the paywall options builder.

If provided, the PaywallViewModel will call the function, and if the subscriptionOption function returns non-null then it will use awaitPurchase function that takes a SubscriptionOption rather than a Package.

These changes were tested locally by running our app from the branch on our fork, and has been in the production version of our Android app for the past few weeks.

Note that I have not written any unit tests, as I am unsure if required here, but would be more than happy to if you deem necessary! 😄

simonmitchell avatar Oct 09 '24 15:10 simonmitchell

Hi @JayShortway any chance we can get some feedback on this PR? 😄 Be good to get this back into main so we can easier get the latest and greatest SDK improvements without having to merge back into our fork 👍

simonmitchell avatar Jul 30 '25 13:07 simonmitchell

Hey @simonmitchell, thanks for the ping! I think this is a totally fair feature request! We're expanding support for offers on the paywall for the App Store first, with the Play Store being on our backlog. We want to make this configurable on the paywall editor, so that this can eventually be set up without having to make app updates.

I'd like to understand your use case a bit better. You mention you're using offer codes. What's the flow here exactly? Does your custom paywall UI have an offer code text field, which is then reflected in the paywall footer if the code is valid? If so, does your app do custom validation of this offer code? (Or are you using Play Store offer codes somehow?) I'd be curious to know. Thanks in advance!

JayShortway avatar Jul 31 '25 09:07 JayShortway

@JayShortway any plans on moving forward with this? For example our usecase is that we have multiple discounts at the same time. And we need to create new play store subscriptions for each discount which makes it harder to keep them im sync and also provide the user with winbacks and so.

skienzl avatar Dec 11 '25 10:12 skienzl

Hi @skienzl, let me ask the team for any updates. In your usecase, what is (or would be) the logic to determine the SubscriptionOption for a user?

JayShortway avatar Dec 12 '25 12:12 JayShortway