Getting Started

APIs provided by Stash that your backend can call.

What this section is

Stash-hosted endpoints your backend calls.

This is an egress integration: your backend calls Stash. Stash hosts and maintains these APIs, while you implement the server-side caller in your backend services.

Call Stash API endpoints from your backend only. Do not expose private API keys in game clients.

Keep credentials on the server, call these endpoints from backend code only, and handle auth, retries, and idempotency in your service layer.

Endpoints

Generate loyalty URL

Generates a loyalty URL for the authenticated user. This URL provides access to the user's loyalty program and rewards.

Approve custom login

Used to approve custom login requests using JWT authentication (For exampe Apple ID, Google or other JWT based login providers). This is a server-side endpoint and should not be called from the client.

Approve Apple Game Center login

Approves authentication using Apple Game Center. Validates the player's Game Center credentials and logs in the user into the webshop.

Approve Facebook login

Approves authentication using Facebook. Validates the player's Facebook credentials and logs in the user into the webshop.

Approve Google Play login

Approves authentication using Google Play Games. Validates the player's Google Play credentials and logs in the user into the webshop.

Generate loyalty URL

Generates a loyalty URL for the authenticated user. This URL provides access to the user's loyalty program and rewards.

Save authentication tokens temporarily

Allows game backends to save access and refresh tokens temporarily, returning a short code challenge that can be passed via launcher deeplinks.

Link

Link Apple Game Center

Link Google Play

List plans

Lists all available subscription plans for a shop. By default returns only active plans. Use the status filter to include archived or deprecated plans.

Get plan by code

Retrieves a subscription plan by its code (e.g., 'monthly_premium'). Plan codes are unique within a segment.

Get plan by ID

Retrieves a subscription plan by its unique identifier. Returns full plan details including pricing, billing period, and trial configuration.

Generate quick pay URL (server)

Generates a quick payment URL for server-side operations. This endpoint is used internally for creating payment links with user information.

Force Logout user

Logs out a user by invalidating their session. This endpoint is typically called when a user signs out of the game or switches to another account.

Generate authenticated URL

Generates an authenticated URL for a specific target (home or loyalty) for a user. This endpoint is used for server-side URL generation.

Get payment event by ID

Retrieves payment details by ID. Returns information about items, pricing, and payment status. This is a server-side endpoint and should not be called from the client.

Get prices

Retrieves uploaded pricing sheet data for the shop associated with the API key, filtered by region. Returns paginated price entries.

Convert prices

Converts amounts from a source currency to a destination country's local currency using live exchange rates. Returns converted amounts in minor units and locale-formatted display strings.

Get user preferences

Retrieves the payment channel preference for a specific user. Returns 404 NotFound if no preference is set.

Set user preferences

Creates or updates the payment channel preference for a user. This is a server-side endpoint and should not be called from the client.

List subscriptions

Query subscriptions by player and optionally filter by status. Returns all matching subscriptions for the specified external_account_id.

Create a subscription checkout link

Creates a checkout link for purchasing a subscription plan. The link can be shared with users to complete their subscription purchase.

Get subscription by ID

Retrieves a subscription by its unique identifier. Returns the full subscription object including status, billing period, and dates.

Cancel subscription

Cancels a subscription. By default, access continues until the end of the current billing period (cancel_at_period_end=true). A subscription.canceled webhook is sent and the returned subscription has status 'canceled'. For past_due subscriptions, cancellation is immediate: a single subscription.expired webhook is sent and the returned subscription has status 'expired'.

Get payments by subscription ID

Retrieves payments associated with a subscription with pagination support. Returns a list of payment objects including payment ID, amount, currency, a succeeded indicator, and timestamps. Use the `next_page_token` from the response to fetch the next page.

Reactivate subscription

Reactivates a previously canceled subscription. Only valid before the subscription has expired.

Create a subscription change checkout link

Creates a checkout link for upgrading an existing subscription to a new plan. Only subscriptions in a `active`, `trialing`, or `cancelled` (still within paid period before expiration) state are eligible for upgrades.

How is this guide?