From 8bf37acefceddf750257e491e8d5e85539538277 Mon Sep 17 00:00:00 2001 From: huda-stash Date: Thu, 26 Feb 2026 08:52:02 -0600 Subject: [PATCH] docs: Document forcePortrait option for landscape-locked games - Add guidance for using forcePortrait=true when game is locked to landscape - Update OpenCard() example to show forcePortrait usage - Clarify that portrait orientation must be enabled in Unity Player Settings - Ensures partners know to set forcePortrait for usable checkout in landscape games Made-with: Cursor --- Assets/Stash.Native/Sample/Scripts/StashSample.cs | 3 +++ README.md | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Assets/Stash.Native/Sample/Scripts/StashSample.cs b/Assets/Stash.Native/Sample/Scripts/StashSample.cs index af6b312..70bc643 100644 --- a/Assets/Stash.Native/Sample/Scripts/StashSample.cs +++ b/Assets/Stash.Native/Sample/Scripts/StashSample.cs @@ -32,6 +32,7 @@ public void OpenCard() // config.tabletHeightRatioPortrait = 0.45f; // config.tabletWidthRatioLandscape = 0.25f; // config.tabletHeightRatioLandscape = 0.5f; + // If your game is locked to landscape, uncomment this to force portrait for checkout: // config.forcePortrait = true; StashNative.Instance.OpenCard(TEST_URL, @@ -90,6 +91,8 @@ public void GenerateLinkAndOpen() { // Open the returned URL in the native card. var config = StashNativeCardConfig.Default; + // If your game is locked to landscape, uncomment this to force portrait for checkout: + // config.forcePortrait = true; StashNative.Instance.OpenCard(url, () => SetStatus("Dismissed"), () => SetStatus("Success"), diff --git a/README.md b/README.md index 8463391..fa1cbee 100644 --- a/README.md +++ b/README.md @@ -72,11 +72,16 @@ public class MyStore : MonoBehaviour { void PurchaseItem(string checkoutUrl) { + var config = StashNativeCardConfig.Default; + // If your game is locked to landscape orientation, force portrait for checkout: + // config.forcePortrait = true; + StashNative.Instance.OpenCard( STASH_URL_TO_OPEN, dismissCallback: OnDialogDismissed, successCallback: OnPaymentSuccess, - failureCallback: OnPaymentFailure + failureCallback: OnPaymentFailure, + config: config ); } @@ -86,6 +91,8 @@ public class MyStore : MonoBehaviour } ``` +**Note for landscape-locked games:** If your Unity game is locked to landscape orientation (`defaultScreenOrientation: 4`), set `config.forcePortrait = true` to ensure checkout displays in portrait mode. Portrait orientation must be enabled in Unity Player Settings (iOS: `allowedAutorotateToPortrait: 1`) for this to work. + All callbacks and config are optional; you can pass only the ones you need or use the global events instead. See the API reference below for more details about configuration options. @@ -176,7 +183,7 @@ Optional per-call config for **`OpenCard`**. **`StashNativeCardConfig.Default`** | Field | Default | Description | |-------|---------|-------------| -| **`forcePortrait`** | `false` | Portrait-locked on phone when true. | +| **`forcePortrait`** | `false` | Portrait-locked on phone when true. **Required for landscape-locked games:** Set to `true` if your Unity game is locked to landscape orientation to ensure checkout displays in portrait. Portrait orientation must be enabled in Unity Player Settings (iOS: `allowedAutorotateToPortrait: 1`). | | **`cardHeightRatioPortrait`** | `0.68f` | Card height ratio portrait (0.1–1.0). | | **`cardWidthRatioLandscape`** | `0.9f` | Card width ratio landscape. | | **`cardHeightRatioLandscape`** | `0.6f` | Card height ratio landscape. |