Skip to main content
Use OpenPopup() to display payment channel selection opt-in dialogs in your Unity project. This allows players to choose between native IAP and Stash Pay payment methods.

Before you begin

This guide assumes you have already set up the Stash Pay Unity SDK. If you haven’t, see the Unity integration guide first.

Opening an Opt-in Popup

Use OpenPopup() for payment channel selection opt-in dialogs. Always handle the OnOptinResponse event:
Opening an Opt-in Popup
Use OpenPopup() exclusively for payment channel selection opt-in flows. For checkout flows, use OpenCheckout() instead.

Configuring Popup Size

OpenPopup() supports optional custom size configuration. By default, it uses platform-specific default sizing. You can customize the size using PopupSizeConfig:
Custom Popup Size Configuration
Note: The popup automatically adjusts its size when the device rotates between portrait and landscape orientations. Custom multipliers are applied relative to the calculated base size (which depends on device type and screen dimensions).

API Reference

Methods

OpenPopup(string url, Action onDismiss = null, Action onSuccess = null, Action onFailure = null, PopupSizeConfig? customSize = null) Opens Stash opt-in and other remote Stash dialogs in a centered modal popup. Size can be customized using PopupSizeConfig. If not provided, uses platform-specific default sizing.

Events

OnOptinResponse (event Action<string>)
  • Fired when user selects a payment channel in opt-in popup. Receives "native_iap" or "stash_pay".

Types

PopupSizeConfig (struct)
  • portraitWidthMultiplier (float) - Width multiplier for portrait orientation
  • portraitHeightMultiplier (float) - Height multiplier for portrait orientation
  • landscapeWidthMultiplier (float) - Width multiplier for landscape orientation
  • landscapeHeightMultiplier (float) - Height multiplier for landscape orientation
Note: Each platform (iOS and Android) has its own default sizing. When customSize is not provided, the platform-specific defaults are used.