Add custom variables support for paywalls#812
Merged
Conversation
2986542 to
02dd394
Compare
Adds the ability to pass custom variables to paywalls for text substitution
using the {{ custom.variable_name }} syntax.
Changes:
- Add `customVariables` parameter to `PaywallOptions` constructors
- Pass custom variables through iOS native layer (RevenueCatUI.m)
- Pass custom variables through Android native layer (PaywallTrampolineActivity)
- Add CustomVariablesEditor to Subtester for testing
- Add PaywallOptionsAPITests for API surface verification
- Bump PHC to 17.33.0 which includes custom variables support
Usage:
```csharp
var options = new PaywallOptions(
customVariables: new Dictionary<string, string>
{
{ "player_name", "John" },
{ "level", "42" }
}
);
await PaywallsPresenter.Present(options);
```
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Aligns the Unity SDK's custom variables API with React Native and Flutter
SDKs by using a CustomVariableValue type with factory method pattern
instead of raw Dictionary<string, string>.
This allows adding new variable types (e.g., numbers, booleans) in the
future without breaking changes.
Usage:
```csharp
var options = new PaywallOptions(
customVariables: new Dictionary<string, CustomVariableValue>
{
{ "player_name", CustomVariableValue.String("John") },
{ "level", CustomVariableValue.String("42") },
}
);
```
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…eValue - Use PaywallActivityLaunchOptions.Builder and PaywallActivityLaunchIfNeededOptions.Builder - Convert Map<String, String> to Map<String, CustomVariableValue.String> - Fix method signatures to match SDK API Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix incorrect Android API usage: use setOfferingIdentifier() instead of non-existent setOfferingId() and setPresentedOfferingContext() methods - Update purchases-hybrid-common from 17.37.0 to 17.39.0 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The builder's setOfferingIdentifier method requires @OptIn(InternalRevenueCatAPI) which cannot be properly used from Java code. Use the deprecated public launch() overloads instead for launchPaywall, which handle the internal API opt-in themselves. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Unity requires .meta files alongside every asset. These were missing for: - RevenueCatUI/Scripts/CustomVariableValue.cs - IntegrationTests/Assets/APITests/PaywallOptionsAPITests.cs - Subtester/Assets/Scripts/CustomVariablesEditor.cs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix RevenueCat.SimpleJSON namespace reference in PaywallOptions.cs - Add missing .meta file for PaywallsBehaviourAPITests.cs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The deprecated launcher.launch() overloads no longer exist in PHC 17.41.1. Use PaywallActivityLaunchOptions.Builder pattern consistent with launchPaywallIfNeeded. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This belongs in the other/integration-tests2 branch (PR #735), not here. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0d4949a to
071bcde
Compare
… paywall logic Replaced runtime custom variables UI editor with Inspector-based editing, added configurable offering identifier, and consolidated paywall presentation into shared BuildPaywallOptions/FetchOfferingIfNeeded helpers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ank lines Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
vegaro
reviewed
Mar 11, 2026
Resolve conflicts by integrating custom variables with main's new architecture: - PaywallOptions: add customVariables alongside presentationConfiguration and purchaseLogic - iOS bridge: thread customVariablesJson through all presentation functions (including purchase logic variants) - Android bridge: thread customVariablesJson through PaywallViewPresenter (replaces deleted PaywallTrampolineActivity) - Subtester: migrate custom variables to new PaywallScreen with inline key/value fields - Remove old CustomVariablesEditor and PurchasesListener (replaced by new screen-based Subtester) - Update PaywallOptionsAPITests for new constructor parameters Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move customVariables param after purchaseLogic in PaywallOptions constructors to preserve positional argument compatibility with existing callers - Skip null values in ToStringDictionary to prevent NRE when users pass null CustomVariableValue entries in the dictionary - Add custom variables Inspector support to PaywallsBehaviour with serializable CustomVariableEntry array - Restore PaywallsBehaviourAPITests.cs that was accidentally deleted - Add positional argument compatibility tests to PaywallOptionsAPITests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… name Also refactor PaywallOptions constructors to use constructor chaining and eliminate redundant intermediate dictionary in CustomVariablesToJsonString. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add defaultOfferingIdentifier and defaultCustomVariables fields to TesterApp - Pre-populate PaywallScreen fields from editor values - Add offering ID text field to Paywalls screen UI - Replace StoreKit config with PaywallsTester products - Set API keys and default offering in scene Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
vegaro
requested changes
Mar 12, 2026
…changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…n.unity Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ariables Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
vegaro
reviewed
Mar 12, 2026
vegaro
approved these changes
Mar 12, 2026
…iableEntry coverage Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
rickvdl
pushed a commit
that referenced
this pull request
Mar 17, 2026
**This is an automatic release.** ## RevenueCat SDK ### ✨ New Features * Add trackCustomPaywallImpression API (#863) via Toni Rico (@tonidero) ### 📦 Dependency Updates * Updates purchases-hybrid-common to 17.51.1 (#866) via RevenueCat Git Bot (@RCGitBot) * [Android 9.26.1](https://github.com/RevenueCat/purchases-android/releases/tag/9.26.1) * [Android 9.26.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.26.0) * [Android 9.25.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.25.0) * [Android 9.24.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.24.0) * [iOS 5.65.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.65.0) * [iOS 5.64.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.64.0) * [iOS 5.63.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.63.0) * [iOS 5.62.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.62.0) * [AUTOMATIC BUMP] Updates purchases-hybrid-common to 17.51.0 (#864) via RevenueCat Git Bot (@RCGitBot) * [Android 9.26.1](https://github.com/RevenueCat/purchases-android/releases/tag/9.26.1) * [Android 9.26.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.26.0) * [Android 9.25.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.25.0) * [Android 9.24.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.24.0) * [iOS 5.65.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.65.0) * [iOS 5.64.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.64.0) * [iOS 5.63.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.63.0) * [iOS 5.62.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.62.0) * [AUTOMATIC BUMP] Updates purchases-hybrid-common to 17.50.0 (#862) via RevenueCat Git Bot (@RCGitBot) * [Android 9.26.1](https://github.com/RevenueCat/purchases-android/releases/tag/9.26.1) * [Android 9.26.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.26.0) * [Android 9.25.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.25.0) * [Android 9.24.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.24.0) * [iOS 5.65.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.65.0) * [iOS 5.64.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.64.0) * [iOS 5.63.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.63.0) * [iOS 5.62.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.62.0) * [AUTOMATIC BUMP] Updates purchases-hybrid-common to 17.49.0 (#860) via RevenueCat Git Bot (@RCGitBot) * [Android 9.26.1](https://github.com/RevenueCat/purchases-android/releases/tag/9.26.1) * [Android 9.26.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.26.0) * [Android 9.25.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.25.0) * [Android 9.24.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.24.0) * [iOS 5.65.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.65.0) * [iOS 5.64.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.64.0) * [iOS 5.63.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.63.0) * [iOS 5.62.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.62.0) * [AUTOMATIC BUMP] Updates purchases-hybrid-common to 17.48.0 (#859) via RevenueCat Git Bot (@RCGitBot) * [Android 9.26.1](https://github.com/RevenueCat/purchases-android/releases/tag/9.26.1) * [Android 9.26.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.26.0) * [Android 9.25.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.25.0) * [Android 9.24.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.24.0) * [iOS 5.65.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.65.0) * [iOS 5.64.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.64.0) * [iOS 5.63.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.63.0) * [iOS 5.62.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.62.0) * [AUTOMATIC BUMP] Updates purchases-hybrid-common to 17.47.0 (#858) via RevenueCat Git Bot (@RCGitBot) * [Android 9.26.1](https://github.com/RevenueCat/purchases-android/releases/tag/9.26.1) * [Android 9.26.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.26.0) * [Android 9.25.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.25.0) * [Android 9.24.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.24.0) * [iOS 5.65.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.65.0) * [iOS 5.64.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.64.0) * [iOS 5.63.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.63.0) * [iOS 5.62.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.62.0) ## RevenueCatUI SDK ### ✨ New Features * Add custom variables support for paywalls (#812) via Facundo Menzella (@facumenzella) ### 🔄 Other Changes * Bump fastlane-plugin-revenuecat_internal from `e146447` to `3e8c384` (#861) via dependabot[bot] (@dependabot[bot]) * Add .claude/ to .gitignore (#857) via Facundo Menzella (@facumenzella)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
customVariablessupport for paywalls, allowing developers to pass dynamic string values (e.g., player name, level) to paywall templates at runtime using{{ custom.variable_name }}syntax.Changes
CustomVariableValuetype and extension methods for dictionary conversionCustomVariablesparameter toPaywallOptionswith JSON serializationRevenueCatUI.m)CustomVariablesEditorto Subtester app for runtime testingPaywallOptionsAPITests🤖 Generated with Claude Code