Skip to main content
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.
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.
To create a checkout session, send a POST request from your backend to the /sdk/server/checkout_links/generate_quick_pay_url endpoint. Please check out the full API reference to see all the payload options. Here’s a sample payload for creating a checkout link:
Generate Checkout Payload
If your request succeeds, you will receive a checkout URL that you can present to the user using any of the methods described below.
Generate Checkout Response

Authentication

Authenticate calls to generate_quick_pay_url by signing the request body with your ingress secret and including the signature in the x-stash-hmac-signature header. Your ingress secret is distinct from the egress key used to verify Stash’s outbound requests. Both are in Studio → Project Settings → API Keys as base64-encoded values; base64-decode before use as the HMAC key.
The signature covers "<unixMillisTimestamp>." + <body>, where <body> is the exact JSON bytes you POST. Sign what you transmit — Stash verifies against the bytes received. Requests where <unixMillisTimestamp> is more than 5 minutes from the server clock are rejected. For Node.js, Python, and Go implementation code, see API Keys → HMAC Signing.
Shops and API keys created before 2026-08-15 can still use X-Stash-Api-Key: <secret> instead. Keys created on or after 2026-08-15 must use versioned HMAC.

Displaying the checkout

The simplest option is to open the checkout URL directly in a browser on the user’s device. For in-app presentation with native drawers, modals, and callbacks, follow the platform-specific integration guide for your stack.

Web Apps & WebGL

React component, vanilla API, and UMD script-tag integration.

Native Apps (iOS / Android)

Card, modal, and browser presentation using the Stash Native SDK.

Unity Integration

Present checkout from Unity projects using the Stash Unity package.

Unreal Engine Integration

Present checkout from Unreal Engine projects using the Stash plugin.

Processing Purchase

Once a player completes checkout, your system must process the event to grant items. Stash supports three patterns depending on your game’s requirements, always server-side, never on the client. The three differ mainly in when they fire relative to the charge, and only one of them lets your server reject a 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, so a single shop uses one of these patterns rather than switching between them. Pick the row that matches your backend, and see the High-Level Flow Options guide for the full sequence of each.
Async post-purchase. Stash sends your backend a PURCHASE_SUCCEEDED webhook after the payment completes.Best for: Backends that process events asynchronously (queues, workers, background jobs), where it’s acceptable for rewards to appear a bit later in the game.Configure your webhook endpoint in Stash Studio and implement a listener that verifies the signature and grants rewards. See the webhook guides for full implementation details:

Testing your integration

To test your Stash Pay integration, use test card numbers in the Stash test environment. These cards allow you to complete transactions safely, as no real charges are created, making repeated testing risk-free.
Environment Requirements:
  • Test/Development/Staging: Use test cards only. Test cards function in test environments and will be rejected in production.
  • Production: Use real, live payment cards only. Real cards are accepted for production transactions and will be rejected in test environments.
  • Apple Pay and Google Pay are not available in the test environment. These payment methods require live mode and will not function when testing.

Testing Tools

Link Generator: Use the Link Generator in Stash Studio to quickly generate and test checkout links without writing code. The Link Generator allows you to: