Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Assets/Stash.Native/Sample/Scripts/StashSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"),
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}

Expand All @@ -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.


Expand Down Expand Up @@ -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. |
Expand Down