Skip to main content

Package repository

github.com/stashgg/stash-native

Package Readme

Detailed usage patterns.

Requirements

  • Android API 21+ (target/compile SDK 34)
  • iOS 13.0+

Install the SDK

1

Android (AAR)

  1. Download the latest AAR from stash-native releases.
  2. Add it to your Android project (for example in libs/).
  3. Reference it in your app module:
2

iOS (XCFramework or SPM)

Use one of the following:
  • XCFramework: download StashNative.xcframework.zip from releases, add it to your project, then set it to Embed & Sign.
  • Swift Package Manager: add https://github.com/stashgg/stash-native.git in Xcode (File -> Add Packages…).

Presentation methods

The SDK lets you present Stash Pay checkout links using three modes: openCard, openModal, and openBrowser. Just provide your generated checkout URL, and you can also pass an optional config object to customize the presentation and subscribe to callbacks.
Stash Native presentation methods overview

openCard (Drawer/sheet)

Use this when you want an in-app checkout view with callbacks for success/failure/dismiss.

openModal (Centered modal)

Use this when you want a centered dialog style with the same callback model as openCard.

openBrowser (Safari View Controller / Chrome Custom Tabs)

Use this when you prefer a browser-based checkout (SFSafariViewController on iOS, Chrome Custom Tabs/system browser on Android).

Callbacks and verification

openCard and openModal use the same callback/delegate model. Typical events:
  • Payment success
  • Payment failure
  • Dialog dismissed
  • External payment started
  • Opt-in response
  • Page loaded
  • Network error
Always verify purchases on your backend before granting items. Client callbacks should drive UX, not final entitlement decisions.

Landscape and orientation notes

Use forcePortrait in card config if your host app is landscape-locked and checkout should appear in portrait.
  • On Android, this opens a portrait checkout activity in the same app process.
  • On iOS, the SDK unlocks portrait for its own checkout/browser windows.
For Android landscape projects, an optional backdrop API (setBackdropBitmap / setBackdropBytes) can reduce visual artifacts during rotation.

Android keep-alive (optional)

For browser-based flows on memory-constrained devices, you can enable keep-alive:
This starts a short foreground service during external browser checkout. Review Play Console declarations if you enable this mode.

Detailed references