Seamlessly integrate the Stash Pay native in-app purchase dialog with Unreal Engine using the Stash plugin and the Stash Pay Native SDK. You can either explore the included Unreal Engine 5.0+ sample project in this repository, or follow the "Setup in Clean Unreal Project" guide below to add Stash Pay integration to your own Unreal 5 project.
- Unreal Engine 5+
- iOS 12.0+ / Android API 21+
Unreal Engine 4 Warning:
We actively maintain Unreal 5 support, we have a sample usage for legacy Unreal Engine 4 (4.27-plus). For Unreal Engine 4 sample please use the4.27-plusbranch of this repository as the wrapper implementation differs.
This repository include a sample scene with bluperints to call stash-native methods. Build locally and try on both platforms. Due to restrictions we currently dont have online-hosted emulator with Unreal demo.
Before using the Stash Pay popup in your Unreal Engine game, you must set up your game server to create Stash Pay checkout URLs using the Stash API.
If you haven't already configured checkout URL generation on your backend, see our Stash Pay Integration Guide for complete instructions.
The Stash Pay integration follows this workflow:
- Server generates checkout URL - Your game server calls the Stash API to create a checkout link
- URL sent to game client - The checkout URL is transmitted to the Unreal Engine client
- Game client displays checkout - Client opens the Stash Pay dialog using this SDK
- Client listens to callbacks - Game receives payment success/failure events
- Server verifies purchase - Your backend validates the purchase via webhooks before granting items
This SDK handles steps 3-4 (client-side display and callbacks). You are responsible for implementing steps 1, 2, and 5 (server-side URL generation, delivery, and verification).
Integration uses a layered architecture to integrate native Stash Pay dialog functionality:
Unreal Engine (C++/Blueprints)
↓
Stash Plugin (Wrapper)
↓
Stash Native SDK (iOS/Android)
Components:
- Stash Plugin (
Plugins/Stash/) - Unreal plugin in this repository. Provides Blueprint and C++ API and wraps the Stash Pay native SDK for iOS and Android. - Stash Native SDK - Native iOS/Android implementation of the Stash Pay checkout dialog (bundled in the plugin’s
ThirdPartyfolder; source inPlugins/stash-native-mainwhen added as submodule).
Follow these steps to integrate Stash Pay into your own Unreal Engine 5.0+ project:
Copy the Plugins/Stash/ folder from this repository into your project’s Plugins/ directory (create it if needed). The plugin includes the Blueprint/C++ wrapper and the Stash Pay native SDK (iOS/Android) in its ThirdParty folder.
To work with or rebuild the native SDK from source, add it as a Git submodule:
cd YourProject
git submodule add https://github.com/stashgg/stash-native.git Plugins/stash-native-mainFolder layout.
This sample project usesPlugins/Stash/for the Unreal plugin and optionallyPlugins/stash-native-mainfor the native SDK source. The Stash plugin ships with pre-built SDKs inPlugins/Stash/Source/Stash/ThirdParty/; the submodule is only needed if you modify the native SDK.
- Open your project in Unreal Engine
- Go to Edit → Plugins, search for Stash
- Enable the Stash plugin and restart the editor
- Open a Level Blueprint or any Blueprint
- You should see Stash category and nodes (e.g. Open Checkout, Is Checkout Open, Dismiss Checkout)
- Package for Android or iOS to test native integration
Once the plugin is set up, you can integrate Stash Pay checkout into your game using either C++ or Blueprints.
Add the Stash module to your module’s Build.cs (e.g. PublicDependencyModuleNames.Add("Stash");), then:
Opening the Checkout:
#include "StashBlueprint.h"
void AYourPlayerController::OpenCheckout(const FString& CheckoutURL)
{
UStashBlueprint::OpenCheckout(CheckoutURL); // Works on both iOS and Android
}Listening to Payment Callbacks:
Bind to the payment success delegate in your controller’s BeginPlay() or initialization code. The delegate has no parameters; use your server or session state to know what was purchased.
// In your PlayerController.h
UFUNCTION()
void OnPaymentSuccessReceived();
// In your PlayerController.cpp BeginPlay()
void AYourPlayerController::BeginPlay()
{
Super::BeginPlay();
UStashBlueprint::OnPaymentSuccess.AddDynamic(this, &AYourPlayerController::OnPaymentSuccessReceived);
}
void AYourPlayerController::OnPaymentSuccessReceived()
{
UE_LOG(LogTemp, Warning, TEXT("Payment succeeded"));
// Grant items, show success UI, etc. (verify purchase on your server via webhooks)
}Opening the Checkout:
- Get the checkout URL from your server
- Use the Open Checkout node (Stash category) and pass the checkout URL string. Same node works on iOS and Android.
- Optionally use Open Checkout With Config to customize card/modal sizing.
Listening to Payment Callbacks:
The OnPaymentSuccess delegate is static. To use it in Blueprints:
- Create a C++ class (e.g. PlayerController) that binds to
UStashBlueprint::OnPaymentSuccessinBeginPlay()(as in the C++ example above) - In that C++ class, declare a
BlueprintImplementableEventand call it from the delegate handler - Implement that event in your Blueprint to handle the purchase
Example pattern:
// In your C++ PlayerController
UFUNCTION(BlueprintImplementableEvent, Category = "Store")
void OnPaymentSucceeded();
void AYourPlayerController::OnPaymentSuccessReceived()
{
OnPaymentSucceeded();
}Then implement OnPaymentSucceeded in your Blueprint to grant items or show UI.
Checking Checkout Status: Use the Is Checkout Open node (Stash category).
Closing the Checkout: Use the Dismiss Checkout node (Stash category).
For a full sample, see this repository:
- Game module:
Source/StashUnreal5/ - Stash plugin:
Plugins/Stash/Source/Stash/(C++ and Blueprint API inPublic/StashBlueprint.h) - Content: Blueprints and sample UI in
Content/MobileStarterContent/(e.g.WBP_Checkout, level Blueprints)
- Unreal Engine 5.0+
- Visual Studio (for Windows/Android development)
- Xcode with iOS SDK (for iOS development)
- Android SDK (for Android builds)
Stash plugin (wrapper and API):
Plugins/Stash/Source/Stash/Public/StashBlueprint.h- Blueprint library and delegatesPlugins/Stash/Source/Stash/Private/IOS/ObjC/StashPayCardWrapper.mm- iOS native bridgePlugins/Stash/Source/Stash/Private/Android/Java/- Android native bridge (StashHelper, StashInit)
Native SDK (pre-built in plugin):
Plugins/Stash/Source/Stash/ThirdParty/iOS/StashPay.xcframework/- iOS SDKPlugins/Stash/Source/Stash/ThirdParty/Android/StashPay.aar- Android SDK
Native SDK source (when using submodule):
Plugins/stash-native-main/iOS/- iOS implementationPlugins/stash-native-main/Android/- Android implementation
- Stash Native SDK - Native SDK documentation
- Stash Pay Docs - Official Stash Pay documentation
If the Stash plugin does not load, or you see native build errors on Android/iOS, ensure the plugin is enabled (Edit → Plugins → Stash), your project has the correct iOS/Android SDKs installed, and that you have copied the full Plugins/Stash/ folder including the ThirdParty binaries.
For Stash Pay integration issues, contact: developers@stash.gg
