# Stash Documentation - Complete Reference for AI This document contains the complete Stash documentation for AI assistance. Generated: 2026-09-22T22:50:16.826Z ## About Stash Stash is a comprehensive platform for game developers offering: - **Stash Studio**: Web-based developer portal for managing integrations - **Stash Webshop**: In-game commerce and webshop solution - **Stash Pay**: Payment processing with better rates than traditional platforms - **Stash Launcher**: Game launcher platform ## Documentation Sections ## Section: Guides # Quick Start **URL:** https://docs.stash.gg/guides **Description:** Get started with Stash - the comprehensive direct-to-consumer platform that helps game developers engage with players and sell content through checkout flows, webshops, and other experiences. Stash is a direct-to-consumer platform for game developers. We help you engage with and sell content directly to players by building checkout flows, webshops, and other experiences (loyalty programs, leaderboards, game launchers, etc.). Stash also manages payments and compliance so that you can focus on game development and player experiences. ## Get To Know Stash [#get-to-know-stash] ## Jump To Product Details [#jump-to-product-details] ## Stash Tools [#stash-tools] --- ## Section: Guides # Stash Docs MCP **URL:** https://docs.stash.gg/guides/stash-docs-mcp **Description:** Connect an AI agent to the Stash documentation over MCP, or load every page as a single Markdown file. ## Connect an agent [#connect-an-agent] The MCP server runs at `https://docs.stash.gg/api/mcp` over HTTP and needs no credentials. Most MCP clients take this config: ```json { "mcpServers": { "stash-docs": { "url": "https://docs.stash.gg/api/mcp" } } } ``` | Tool | Returns | | ------------ | ------------------------------------------------------------------------------- | | `list_pages` | Every page, grouped by section, with title, description, and URL | | `get_page` | The Markdown of one page. Takes the page URL, such as `/guides/stash-pay/about` | | `search` | Full-text matches, grouped by section | ## Markdown files [#markdown-files] Use these when the client can't speak MCP. * Every page: [`llms-full.txt`](https://docs.stash.gg/llms-full.txt), 96 pages in one file, \~430 KB. * One page: append `.mdx` to its URL, for example `https://docs.stash.gg/guides/stash-pay/about.mdx`. --- ## Section: Guides # Demo Hub **URL:** https://docs.stash.gg/guides/get-started/demo-hub **Description:** Explore our fictional game called "Howling Woods" that serve as a demo hub. Download our sample app to experience Stash Pay, explore interactive webshop or see how you can reach desktop gamers using Stash Launcher. ## Demo App [#demo-app] Begin by trying out our demo app on Android or iOS device. With this app, you can experience the full **Stash Pay** flow integrated directly into the Unity game. To try the full in-app purchase flow, use one of the test cards. You can try the demo app instantly in your browser using the online emulator, or install it on your own device by requesting TestFlight access (iOS) or downloading the APK (Android). ## Demo Webshop [#demo-webshop] Explore the Howling Woods demo shop to experience the Stash webshop in action. The demo includes integration with custom authentication provider (Amazon Cognito), a dynamic product catalog, and interactive features like a reward wheel, card draw, card match, and more showcasing what you can add to your own integration. Just like in the app above, you can test the complete in-app purchase process using one of our test cards. Webshop is also integrated with our demo app and launcher, so all three product works seamlessly together. Install the app and try out the account linking by scaning a login QR code on the webshop. ## Demo Launcher [#demo-launcher] Discover how to engage desktop players using Stash Launcher. Visit the launcher download page to try it for yourself and see how the mobile app seamlessly connects and works alongside the desktop launcher. This download page is automatically generated by Stash for you, or you can also distribute using your own channels. --- ## Section: Guides # Test Card Numbers **URL:** https://docs.stash.gg/guides/get-started/test-cards **Description:** Use test card numbers to test your Stash Pay and Stash Webshop integrations. These test cards work with Stash's test environment and Stash Howling Woods demo. **Important:** Test cards do not create real charges. All transactions using these test card numbers are processed in Stash's test environment and will never result in actual payment processing or charges to any real payment method. **Apple Pay and Google Pay do not work in the test environment without individual setup.** Both require sandbox accounts. Contact your Stash representative to provision them for your test environment if needed. ## Quick Start Test Card [#quick-start-test-card] For quick testing, you can use this simple test card: | Form field | Value | | :---------- | :------------------ | | Card number | 4400 0020 0000 0004 | | Expiration | 03/30 | | CVC | 737 | | Country | Any address | | ZIP | Any five digits | ## Visa Visa [#visa-] | Card Number | Card Type | Issuing Country/region | Expiry Date | CVV2 | | -------------------------------------------- | ------------------------- | ---------------------- | ----------- | ---- | | 4111 1111 4555 1142 (Security code optional) | Classic | NL | 03/2030 | 737 | | 4111 1120 1426 7661 (eight-digit BIN) | Debit | FR | 12/2030 | 737 | | 4988 4388 4388 4305 | Classic | ES | 03/2030 | 737 | | 4166 6766 6766 6746 | Classic | NL | 03/2030 | 737 | | 4646 4646 4646 4644 | Classic | PL | 03/2030 | 737 | | 4000 6200 0000 0007 | Commercial Credit | US | 03/2030 | 737 | | 4000 0600 0000 0006 | Commercial Debit | US | 03/2030 | 737 | | 4293 1891 0000 0008 | Commercial Premium Credit | AU | 03/2030 | 737 | | 4988 0800 0000 0000 | Commercial Premium Debit | IN | 03/2030 | 737 | | 4111 1111 1111 1111 | Consumer | NL | 03/2030 | 737 | | 4444 3333 2222 1111 | Corporate | GB | 03/2030 | 737 | | 4001 5900 0000 0001 | Corporate Credit | IL | 03/2030 | 737 | | 4000 1800 0000 0002 | Corporate Debit | IN | 03/2030 | 737 | | 4000 0200 0000 0000 | Credit | US | 03/2030 | 737 | | 4000 1600 0000 0004 | Debit | IN | 03/2030 | 737 | | 4002 6900 0000 0008 | Debit | AU | 03/2030 | 737 | | 4400 0000 0000 0008 | Debit | US | 03/2030 | 737 | | 4484 6000 0000 0004 | Fleet Credit | US | 03/2030 | 737 | | 4607 0000 0000 0009 | Fleet Debit | MX | 03/2030 | 737 | | 4977 9494 9494 9497 | Gold | FR | 03/2030 | 737 | | 4000 6400 0000 0005 | Premium Credit | AZ | 03/2030 | 737 | | 4003 5500 0000 0003 | Premium Credit | TW | 03/2030 | 737 | | 4000 7600 0000 0001 | Premium Debit | MU | 03/2030 | 737 | | 4017 3400 0000 0003 | Premium Debit | RU | 03/2030 | 737 | | 4005 5190 0000 0006 | Purchasing Credit | US | 03/2030 | 737 | | 4131 8400 0000 0003 | Purchasing Debit | GT | 03/2030 | 737 | | 4035 5010 0000 0008 | Visa | FR | 03/2030 | 737 | | 4151 5000 0000 0008 | Visa Credit | US | 03/2030 | 737 | | 4199 3500 0000 0002 | Visa Proprietary | FR | 03/2030 | 737 | ## Visa Electron Visa Electron [#visa-electron-] | Card Number | Issuing Country/region | Expiry Date | CVV2/CVC3 | | ------------------- | ---------------------- | ----------- | --------- | | 4001 0200 0000 0009 | BR | 03/2030 | 737 | ## Mastercard Mastercard [#mastercard-] | Card Number | Card Type | Issuing Country/region | Expiry Date | CVC3 | | -------------------------------------------- | ----------------- | ---------------------- | ----------- | ---- | | 2222 4000 7000 0005 | Commercial Debit | CA | 03/2030 | 737 | | 5555 3412 4444 1115 (Security code optional) | Consumer | NL | 03/2030 | 737 | | 5577 0000 5577 0004 | Consumer | PL | 03/2030 | 737 | | 5555 4444 3333 1111 | Consumer | GB | 03/2030 | 737 | | 2222 4107 4036 0010 | Corporate | NL | 03/2030 | 737 | | 5555 5555 5555 4444 | Credit | GB | 03/2030 | 737 | | 2222 4107 0000 0002 | Corporate Credit | NL | 03/2030 | 737 | | 2222 4000 1000 0008 | Credit | CA | 03/2030 | 737 | | 2223 0000 4841 0010 | Credit | NL | 03/2030 | 737 | | 5130 2900 0000 0009 | Credit | FR | 03/2030 | 737 | | 2222 4000 6000 0007 | Debit | CA | 03/2030 | 737 | | 2223 5204 4356 0010 | Debit | NL | 03/2030 | 737 | | 2222 4000 3000 0004 | Fleet Credit | CA | 03/2030 | 737 | | 5100 0600 0000 0002 | Premium Credit | US | 12/2029 | 737 | | 2222 4000 5000 0009 | Purchasing Credit | CA | 03/2030 | 737 | | 5103 2219 1119 9245 | Prepaid | BR | 03/2030 | 737 | ## American Express (Amex) American Express [#american-express-amex-] | Card Number | Card Type | Issuing Country/region | Expiry Date | Security Code | | ------------------ | --------- | ---------------------- | ----------- | ------------- | | 3714 4963 5398 431 | Credit | US | 03/2030 | 7373 | | 3700 0000 0000 002 | Credit | US | 03/2030 | 7373 | ## US Debit [#us-debit] | Card Number | Card Type | Issuing Country | Expiry Date | CVV2/CVC3 | | ------------------- | --------------------------------------------- | --------------- | ----------- | --------- | | 4400 0020 0000 0004 | Visa Debit / Accel / STAR / Maestro USA | US | 03/30 | 737 | | 4000 0330 0330 0335 | Visa Debit / PULSE / NYCE | US | 03/30 | 737 | | 5002 5100 0000 0013 | Mastercard Debit / Accel / STAR / Maestro USA | US | 03/30 | 737 | | 5413 3300 3300 3303 | Mastercard Debit / PULSE / NYCE | US | 03/30 | 737 | | 6011 6099 0000 0003 | Discover Debit / Accel / STAR / Maestro USA | US | 03/30 | 737 | | 6445 6450 0000 0002 | Discover Debit / PULSE / NYCE | US | 03/30 | 737 | ## 3D Secure Test Cards [#3d-secure-test-cards] The following cards are enrolled in 3D Secure 2. You can use them to test 3D Secure 2 authentication scenarios. | Card Type | Card Number | Expiry Date | Security Code (CVC/CVV/CID) | | ----------------------------- | ------------------- | ----------- | --------------------------- | | American Express | 3714 4963 5398 431 | 03/2030 | 7373 | | Bancontact / Maestro | 6703 4444 4444 4449 | 03/2030 | Not applicable | | Bancontact / Visa | 4871 0499 9999 9910 | 03/2030 | 737 | | Cartes Bancaires / Visa Debit | 4035 5014 2814 6300 | 03/2030 | 737 | | Cartes Bancaires | 4360 0000 0100 0005 | 03/2030 | 737 | | China UnionPay (Credit) | 6250 9470 0000 0014 | 03/2030 | 123 | | China UnionPay (Debit) | 6250 9460 0000 0016 | 03/2030 | 123 | | Diners | 3056 9309 0259 04 | 03/2030 | 737 | | Discover | 6011 1111 1111 1117 | 03/2030 | 737 | | JCB / Mastercard | 3566 1111 1111 1113 | 03/2030 | 737 | | Maestro | 5000 5500 0000 0029 | 03/2030 | Not applicable | | Mastercard | 5454 5454 5454 5454 | 03/2030 | 737 | | Mastercard Credit | 2222 4000 1000 0008 | 03/2030 | 737 | | Visa | 4917 6100 0000 0000 | 03/2030 | 737 | | Visa Classic | 4166 6766 6766 6746 | 03/2030 | 737 | ## Testing refusal reasons [#testing-refusal-reasons] You can simulate specific decline scenarios — insufficient balance, blocked cards, fraud, expired cards, and more — by typing a special value into the **cardholder name** field at checkout. Any of the test card numbers above will work; the cardholder name decides which refusal reason is returned. ### How to use [#how-to-use] 1. Pick any test card from the tables above. 2. Enter the **expiration date** and **CVC** as listed. 3. In the **cardholder name** field, enter one of the values from the table below (case-insensitive). 4. Submit the payment. The checkout will fail with the matching refusal reason, and a `PURCHASE_FAILED` webhook will be delivered with the same reason in the payload. Cardholder-name overrides only apply in the test environment. In production, the cardholder name is treated as a normal name and has no effect on the transaction outcome. ### Refusal reasons [#refusal-reasons] | Cardholder name | Refusal reason | | :---------------------------- | :-------------------------- | | `NOT_ENOUGH_BALANCE` | Not enough balance | | `CARD_EXPIRED` | Expired card | | `INVALID_CARD_NUMBER` | Invalid card number | | `INVALID_AMOUNT` | Invalid amount | | `INVALID_PIN` | Invalid PIN | | `PIN_TRIES_EXCEEDED` | PIN tries exceeded | | `PIN_VALIDATION_NOT_POSSIBLE` | PIN validation not possible | | `CVC_DECLINED` | CVC declined | | `AVS_DECLINED` | AVS declined | | `BLOCKED_CARD` | Blocked card | | `RESTRICTED_CARD` | Restricted card | | `WITHDRAWAL_AMOUNT_EXCEEDED` | Withdrawal amount exceeded | | `WITHDRAWAL_COUNT_EXCEEDED` | Withdrawal count exceeded | | `TRANSACTION_NOT_PERMITTED` | Transaction not permitted | | `NOT_SUPPORTED` | Not supported | | `FRAUD` | Fraud | | `FRAUD_CANCELLED` | Fraud — cancelled | | `ISSUER_SUSPECTED_FRAUD` | Issuer suspected fraud | | `ISSUER_UNAVAILABLE` | Issuer unavailable | | `ACQUIRER_ERROR` | Acquirer error | | `REVOCATION_OF_AUTH` | Revocation of authorisation | | `REFERRAL` | Referral | | `SHOPPER_CANCELLED` | Shopper cancelled | | `3D_NOT_AUTHENTICATED` | 3D Secure not authenticated | | `DECLINED_NON_GENERIC` | Declined — non generic | | `NOT_SUBMITTED` | Not submitted | --- ## Section: Guides # About Stash Launcher **URL:** https://docs.stash.gg/guides/stash-launcher/about **Description:** Discover Stash Launcher - a customizable direct-to-consumer distribution platform for delivering PC games directly to players on Windows and macOS. Experience features like custom branding, incremental updates, in-game purchases, community engagement tools, and seamless management through Stash Studio or CLI automation. Experience the player journey by downloading our Howling Woods demoshop launcher. Stash Launcher is a customizable direct-to-consumer (D2C) distribution platform that enables you to deliver PC games directly to players on Windows and macOS. Built for developers who want complete control over their distribution, the launcher supports incremental updates, branded experiences, and seamless integration with your existing game ecosystem. ## Highlights [#highlights] * **Custom branding**: Fully customize the launcher based on your game-specific branding and design. * **Incremental updates**: Automatically patch and deliver game updates to players, with smaller downloads. * **In-game purchases**: Integrate Stash Pay directly in your game binary. The checkout experience stays consistent across your webshop and launcher. * **Community engagement**: Create features like social hubs to foster player interaction and retention. * **Seamless management and deployment**: Manage updates through Stash Studio or use the Stash CLI to automate deploys using your existing CI/CD pipeline. * **Multiple release channels**: Set up separate channels for beta testing, QA, or gated access to specific builds. Control which players can access each version and manage staged rollouts with ease. ## Use cases [#use-cases] ### Direct game distribution [#direct-game-distribution] Distribute your PC games directly to players without relying on third-party platforms. Maintain complete control over pricing, player relationships, and the download experience while reducing platform fees and restrictions. ### Beta testing and release management [#beta-testing-and-release-management] Create separate distribution channels for production, beta, and internal testing builds. Control who has access to specific versions and gather feedback from targeted user groups before wider releases. ### Community hub integration [#community-hub-integration] --- ## Section: Guides # Integrating Stash Launcher **URL:** https://docs.stash.gg/guides/stash-launcher/integration **Description:** Learn how to set up Stash Launcher with no coding required. Customize your launcher's appearance, configure release channels, and upload your first build through an intuitive interface in Stash Studio. Base Stash Launcher setup requires no coding. Simply customize your launcher's appearance, configure your release channels, and upload your first build—all through an intuitive interface. ## 1. Configure Appearance [#1-configure-appearance] Open Stash Studio to begin customizing your launcher's appearance and branding. ### Select your game project [#select-your-game-project] Select your game project in Stash Studio. ### Navigate to Launcher [#navigate-to-launcher] Click on "Launcher" in the main navigation. ### Open Appearance settings [#open-appearance-settings] Go to the "Appearance" section in the sub-navigation. Here, you can set your launcher's background image, logo, and other visual elements. You can also configure how your installers and download page will look for both Windows and macOS—all from this single interface. To see your download page live, navigate to General Settings in Stash Studio and find your project URL. Use \/download to access your download hub. ## 2. Create Your Channels [#2-create-your-channels] In the "Channels" section of Stash Studio, you'll find your default Public channel. This channel can have a build attached, or not. If no build is attached to the Public channel, players will need an access code to download your game. You can use the default Public channel or create new channels as needed. When creating a new channel, you can choose whether it should be code-protected or open to all players. --- ## Section: Guides # Launcher Concepts **URL:** https://docs.stash.gg/guides/stash-launcher/launcher-concepts **Description:** Learn the core concepts behind Stash Launcher including releases and build management, launcher deployment methods, incremental updates using the wharf protocol, silent self-updating capabilities, player authentication, and in-game purchases with Stash Pay. Before you upload your game build and configure your launcher, let's get familiar with the core concepts behind Stash Launcher. ## Releases and build management [#releases-and-build-management] Releases are collections of game builds for Windows and macOS, organized into channels. Each channel can include both Windows and Mac builds, letting you manage who gets access to which version—such as "Beta" for testing or "Stable" for production. Upload builds via Stash Studio or the [CLI](#stash-cli). Every project has a public channel open to all players. For restricted access, create private channels that require access codes, which you can manage in Stash Studio. Codes control who can join a channel and how many times they can be used. ## Launcher deployment [#launcher-deployment] ### Installers [#installers] Your launcher is deployed to players using a standalone **NSIS installer (Windows)** or **universal disk image (macOS)**. All launcher related binaries are **automatically code signed and notarized by Stash** to ensure players receive a fully compliant binary with no security warning. Both the Windows installer and Mac disk image are customizable via Stash Studio. You can use customized icons, graphical assets, EULAs, and other extensions like deep link registration, registry entries, or a custom install process.
### Download Hub [#download-hub] In addition to the installer, Stash automatically creates a fully customizable download hub with always up-to-date links for every supported platform. You can integrate this download page into your Stash webshop or host it as a completely standalone page. This download page then acts as a default method of delivery.
### Other Methods [#other-methods] If you prefer to use a custom delivery method or distribute your launcher through platforms like Steam, that's fully supported—you'll always have access to the latest signed binary download links in Stash Studio. ## Incremental updates [#incremental-updates] Stash Launcher uses the [**wharf** protocol](https://itch.io/docs/wharf/algorithms/diff.html) for efficient game patching and updates. Wharf is a binary diffing system that enables incremental updates by only downloading and applying changes between game versions, rather than requiring full re-downloads. ### Patching Process [#patching-process] The patching system operates in several key phases: ### Patch application [#patch-application] When a new game version is available, the launcher downloads a patch file containing the binary differences between the current and target versions. ### Source validation [#source-validation] The system validates the existing game installation against the expected source state to ensure patch compatibility. ### Incremental patching [#incremental-patching] The wharf patcher applies changes file-by-file, creating the new version by combining unchanged files from the source with new or modified content from the patch. ### Progress tracking [#progress-tracking] Throughout the patching process, players receive real-time progress updates showing the current file being processed and overall completion percentage. ### Atomic updates [#atomic-updates] The entire patch operation is committed atomically, ensuring the game installation remains in a consistent state even if the process is interrupted. Learn more about tech behind our patching algorithm:
* How Stash servers creates binary diffs
* How launcher applies patches
## Launcher updates [#launcher-updates] The launcher itself supports completely silent, self-updating capabilities on both platforms. After players install the launcher, updates are downloaded and installed in the background without any user intervention. Updates are never applied while a game is running, so gameplay is never interrupted. Instead, the new version is silently installed and activated the next time the launcher is restarted, ensuring players are always on the latest version with zero disruption to their gaming experience. ### Silent self-updating process [#silent-self-updating-process] ### Self-Update Process [#self-update-process] The launcher automatically keeps itself up to date through a seamless process: ### Automatic version checking [#automatic-version-checking] The launcher periodically checks for newer versions by comparing its current build version against the latest available version from Stash's servers. ### Background download [#background-download] When an update is available, the launcher downloads the new version as a compressed package to a temporary directory without interrupting the player's current session. ### Seamless replacement [#seamless-replacement] The update process extracts the new launcher executable and replaces the current one atomically, ensuring no downtime or visible interruption to players. ### Platform-specific handling [#platform-specific-handling] The system handles platform-specific requirements automatically: * **Windows**: Direct executable replacement * **macOS**: Proper handling of app bundle structure and code signing ### Zero user interaction [#zero-user-interaction] The entire process requires no player input, notifications, or restarts. Players continue using the launcher normally while updates happen transparently. ## Player authentication [#player-authentication] Note: Stash Launcher Authentication is currently in development and will be available soon. ## In-game purchases [#in-game-purchases] In-game purchases with the Stash Launcher are handled using **Stash Pay**. When a player initiates a purchase from within the game (on either Windows or macOS), the launcher uses Stash Pay to generate a secure checkout link. This link automatically authenticates the player and redirects them to the Stash Webshop's checkout page, providing a seamless and consistent purchase experience across both the in-game store and the webshop. --- ## Section: Guides # About Stash Pay **URL:** https://docs.stash.gg/guides/stash-pay/about **Description:** Discover Stash Pay - a direct-to-consumer payment system designed for games and apps that offers a modern alternative to traditional in-app purchases. Integrate through browser checkout, in-game popups, websites, or custom shops. Stash Pay is a direct-to-consumer (D2C) payment system for games and apps that replaces traditional in-app purchases (IAP) from Apple and Google with a secure, branded web checkout. You can integrate Stash Pay through a mobile-friendly web checkout or an in-game popup. It also works on websites, custom shops, and desktop or game clients. See the [Howling Woods demo](https://howlingwoods.shop) for an example of a full Stash Pay purchase flow. ## Use cases [#use-cases] ### In-app purchases [#in-app-purchases] Sell digital goods directly in your app using Stash Pay’s secure, branded web checkout. It works as a D2C alternative to Apple and Google’s native in-app purchases, so no traditional IAP flow is required. Players are sent to a fast, mobile-friendly page (or in-game dialog) to buy items like coin packs or skins, following the guidelines that allow external purchases in certain regions.
### Web integration [#web-integration] You can add Stash Pay checkout to your website or custom store for secure payments. Your site starts the checkout session, and Stash Pay handles the payment processing and session management.
## Customizable [#customizable] You can customize the Stash Pay checkout experience so it matches the look and feel of your game. Partners can adjust branding elements, localize content, and configure which payment methods are shown. This allows the checkout to feel more integrated with the rest of the game.
--- ## Section: Guides # High-Level Flow **URL:** https://docs.stash.gg/guides/stash-pay/flow **Description:** Learn how Stash Pay's purchase flow works and discover three integration patterns for granting purchases based on your existing infrastructure. This article walks through three Stash Pay integration patterns and when to use each one, based on: * Your game-specific technical requirements and limitations. * Your backend architecture (async/event-based vs. synchronous). * Your preferred in-game purchase-granting behavior. ## Initial Setup [#initial-setup] ### Set up Stash Pay instance [#set-up-stash-pay-instance] To set up Stash Pay, contact the Stash team. After onboarding, you'll receive access to **Stash Studio**, our developer portal. Your game instance (including payment processing) will be created for you so you can begin the integration. ### Get your API key [#get-your-api-key] Once you have your Stash Studio instance all set up, the only prerequisite is creating your first API key. You'll use this key to call Stash Pay API endpoints from your game backend. Specifically, you'll need an Ingress API key for the `GetPaymentEvent` endpoint, and an Egress API key for the `ConfirmPayment` endpoint. ## Core Checkout Flow (Common to All Options) [#core-checkout-flow-common-to-all-options] All three options share the same basic checkout flow: ### Requesting Checkout [#requesting-checkout] From your game backend, request a checkout session via the Stash API. ### Get Checkout URL [#get-checkout-url] Receive a customized checkout URL and a **checkout link order ID** (UUID) from Stash. Store this ID on your backend, associated with the player and the pending purchase. ### Show Checkout [#show-checkout] Display the checkout to the player via redirect, popup, or in-app browser. The player reviews the purchase and completes payment using the configured payment methods. While these three steps are always consistent, the way you finalize the purchase and grant items can vary. Choose the granting flow that best fits how your game handles reward delivery and payment confirmation below: ## Choosing Your Granting Flow [#choosing-your-granting-flow] Select the pattern that best matches your backend architecture and reward-granting requirements. The three differ mainly in **when they fire relative to the charge**, and only one of them lets your server reject a purchase: | Pattern | When it fires | Direction | Can your server reject? | Best for | | ---------------------------------------------------------- | ------------------------------------------------ | ----------------------- | ------------------------------------- | ---------------------------------------------------------------------------- | | [`ConfirmPayment`](/api/egress/purchase/ConfirmPayment) | Before the charge is captured | Stash calls your server | **Yes.** See the warning in that tab. | Inventory limits, purchase caps, multi-client locking | | `PURCHASE_SUCCEEDED` webhook | After the payment completes | Stash calls your server | No | Backends that process events asynchronously through queues, workers, or jobs | | [`GetPaymentEvent`](/api/ingress/payments/GetPaymentEvent) | After the payment completes, when you ask for it | Your server calls Stash | No | Showing rewards in the client immediately after purchase | **This is an integration-time choice, not a runtime one.** Which delivery mechanism a shop uses is fixed when the shop is configured, not selected per purchase. A single shop uses one of these patterns rather than switching between them, so treat the table above as a decision you make once per integration. **Async post-purchase.** Stash sends your backend a `PURCHASE_SUCCEEDED` event *after* the payment completes. **Direction:** Stash → Game (your backend exposes a webhook endpoint). **Best for:** Backends that already process events via queues, workers, or background jobs. Rewards may appear slightly after purchase. **Flow:** Player completes checkout. Stash finalizes the payment. Stash sends a `PURCHASE_SUCCEEDED` webhook to your backend. Your backend consumes the event, runs game logic, and grants rewards. For full implementation details see the [Webhook guides](/guides/get-started/stash-webhooks/overview). **Synchronous post-purchase.** Your backend asks Stash for the final payment status as soon as the purchase completes. This is a targeted lookup, not a background poll. The trigger is the client's completion signal, which depends on how you present the checkout: the `onSuccess` prop or option on [web](/guides/stash-pay/web-integration/web-apps); the `successCallback` argument of `OpenCard` or `OpenModal` (for example `successCallback: OnSuccess`) in [Unity](/guides/stash-pay/ios-android-integration/unity); and, in browser presentation modes such as `openBrowser`, the deep link that returns the player to your game, since those modes have no success callback (see [Presentation Options](/guides/stash-pay/ios-android-integration/presentation-options)). Your backend already holds the checkout link order ID from creating the link, so it can look the purchase up as soon as the client reports completion. **Direction:** Game → Stash (your backend calls [`GetPaymentEvent`](/api/ingress/payments/GetPaymentEvent)). **Best for:** Games where the client needs to show rewards immediately, or backends designed for synchronous request-response patterns without incoming webhooks. **Flow:** Player completes checkout. The client receives the completion signal (the SDK success callback, or the deep-link return in browser modes) and notifies your backend. Your backend calls [`GetPaymentEvent`](/api/ingress/payments/GetPaymentEvent) with the purchase ID. Stash returns the final payment status. Your backend grants rewards and returns updated state to the client. See the [`GetPaymentEvent` API Reference](/api/ingress/payments/GetPaymentEvent) for request/response details. **Validation before the charge is captured.** Stash calls your backend with [`ConfirmPayment`](/api/egress/purchase/ConfirmPayment) *before* capturing the payment, and waits for your response. This is the only one of the three patterns where your server can **reject** a purchase, and it grants items during the same call. It fires earliest of the three. **Direction:** Stash → Game (your backend exposes the [`ConfirmPayment`](/api/egress/purchase/ConfirmPayment) endpoint). **Best for:** Games with per-player inventory limits, multi-client purchase locking, or any validation that must happen before a purchase is finalized. **Flow:** Player completes checkout. Stash sends a `ConfirmPayment` request to your backend. Your backend validates the purchase (inventory, caps, locks), grants the items, and returns them in the response body. Stash captures the payment. **There is no approve or deny field.** Your server signals success by returning `200 OK` with the granted results in the body. It rejects by returning an HTTP error status. **Any failure response fails the purchase.** Stash treats every non-success response the same way, whether it is a deliberate rejection, an unhandled `500`, a timeout, or a malformed body. When that happens the purchase fails and Stash does not retain the funds. Respond `200 OK` unless you specifically do not want Stash to take the money. For the full request/response schema see the [`ConfirmPayment` API Reference](/api/egress/purchase/ConfirmPayment). --- ## Section: Guides # Integrating Stash Pay **URL:** https://docs.stash.gg/guides/stash-pay/integration **Description:** Learn how to integrate Stash Pay into your game or app with minimum setup. This guide covers creating checkout links, displaying checkouts in browser or in-app, and handling webhook events for secure payment processing. This guide explains how to integrate Stash Pay using the basic setup: creating checkout links, showing the checkout to players, and processing purchase events. The video below provides a quick walkthrough of the integration flow.