Skip to content
  • Our Product
    • Namazu Elements
      • What is Elements?
      • Why open source?
      • Docs
        • Namazu Elements in Five Minutes or Less
        • RESTful APIs Library
        • Security Model
        • Accessing the Web UI (CMS)

    Our Product

    A logomark with three layered rhombuses adorning the lettermark that says Elements in bold all-caps sans-serif letters.
    • What is Namazu Elements? Discover our easy-to-use backend network solution built for online games. Rapidly enables full-scale multiplayer games or online solo adventures.
    • Why open source? Is there a truly open source server backend for connected games? There is now. Download and run a local copy of Namazu Elements and try it for yourself.
    Download Namazu Elements

    Get started

    • Quick start Read our Elements 5-minute quick start guide
    • Documentation Read our developer docs for learning more about Elements
    • RESTful APIs A full list of core API specs for working with the Elements framework
    • Security An overview of the server-authoritative security model of Elements
    • Accessing the CMS Manage your game with ease via the Namazu Elements CMS.

    Co-development Reimagined

    • Best real-time game backends in 2026 If you're researching an alternative to your current backend solution, we've prepared a report of all of the backend solutions on the market in 2026 and how Namazu Elements compares.
      Co-dev

    Recent Posts

    • The watercolor-styled Namazu Studios logo over a giant namazu lurking in the depth
      Namazu Studios Featured in San Diego Business Journal
      22 Sep 2025 Press
    • Namazu Elements 3.1 Released – Service Layer Fixes, Secure APIs, and Steam Bug Fix
      22 Apr 2025 Release Notes
  • Case Studies
  • About Us
  • News
  • Services
  • Book a call
namazu-studios-logo
Book a call
Popular Search Roblox

Getting Started

  • Namazu Elements in Five Minutes or Less
  • Overview
  • Accessing the Web UI (CMS)
  • CMS Feature Overview

Fundamentals

  • Why You Need a Server (and What “Authoritative” Means)
  • Elements as a Game Runtime
  • Where Your Authoritative Code Runs
  • Lifecycles and Flows

General Concepts

  • Custom Elements
  • Data Models
  • Security Model
  • N-Tier Architecture

Namazu Elements Core Features

  • Email Service
  • Applications
  • Sessions
  • Users and Profiles
  • Digital Goods
  • Progress and Missions
  • Progress and Missions (3.4+)
  • Leaderboards
  • Matchmaking – Comprehensive Guide
  • Friends
  • Followers
  • Product Bundles and SKUs
  • Item Ledger
  • Receipts
  • Reward Issuances
  • Save Data
  • Metadata
  • Metadata (3.4+)
  • Queries
  • User Authentication / Sign In
    • What is a User?
    • Email Verification
    • User Authentication in Elements
    • Account Linking
    • Setting Up Twitch OIDC Login (Backend)
    • OIDC Login for Thick Clients (Browser Redirect Flow)
    • Auth Schemes
      • Auth Schemes
      • OAuth2
      • OIDC
  • Features
    • Web3
      • Wallets
      • Vaults
      • Omni Chain Support
      • Smart Contracts
        • Smart Contracts
  • Queries
    • Advanced Operators
    • Object Graph Navigation
    • Boolean Queries
    • Base Query Syntax
  • Advanced Operators
    • .name
    • .ref

Your Game Code - Adding Custom Elements

  • Custom Code Overview
  • Windows Setup
  • Mac OS Setup
  • Ubuntu Linux Setup
  • Element Anatomy: A Technical Deep Dive
  • Introduction to Guice and Jakarta in Elements
  • Structuring your Element
  • Events
  • Packaging an Element with Maven
  • Deploying an Element
  • Preparing for code generation
  • Properties
  • Websockets
  • RESTful APIs
  • Direct MongoDB Access (3.5+)
  • Building the Example Element: A Complete Walkthrough
  • Building the Kotlin Example Element: A Complete Walkthrough

Configuration

  • Configuring External URLs for Deployment
  • Matchmaking – Comprehensive Guide
  • Direct Database Access and Batch Configuration
  • Connecting Namazu Elements to a TLS-Enabled MongoDB Replica Set
  • Batch Samples
    • Mission Upload Bash Script Sample
    • Item Upload Bash Script Sample

RESTful APIs

  • Importing into Postman
  • RESTful APIs Library
  • Swagger and Swagger UI

Add-Ons

  • Crossplay
    • Crossfire Client Libraries (JVM & Browser)
    • Crossfire Protocol Reference
    • Crossfire: Custom Matchmaking Algorithms
    • Namazu Crossfire (Multiplayer)
    • Deploying Namazu Crossfire in your game
  • Roblox
    • Roblox Overview
    • Secure Player Authentication & Registration
    • Global Matchmaking
    • Roblox Security Best Practices
  • Container on Demand
    • Namazu Conductor
    • Namazu Conductor Admin API
    • Configuring Namazu Conductor Providers
  • Commerce
    • Stripe
      • Stripe
      • Configuring the Stripe Element
      • Stripe REST API Reference
      • Stripe REST API Reference

Game Engine & Client Support

  • Unity
    • Elements Unity Plugin
    • Unity Crossfire Plugin
  • Gamemaker
    • Incorporating GMEXT-Elements into a GameMaker Project

Troubleshooting

  • Common Issues with Docker
  • Local SDK
    • Unable to deploy application : dev.getelements.elements.sdk.exception.SdkElementNotFoundException
    • Could not load class : java.lang.NoClassDefFoundError
  • Namazu Elements Community Edition
    • Common Issues with Docker
    • Unable to deploy application : dev.getelements.elements.sdk.exception.SdkElementNotFoundException
    • Running in the IDE
      • Exception in monitor thread while connecting to server localhost:27017
      • Could not deployAvailableApplications Jetty server Failed to bind to /0.0.0.0:8080 Address already in use

Releases

  • 3.8 Release Notes
  • 3.7 Release Notes
  • 3.6 Release Notes
  • 3.5 Release Notes
  • 3.4 Release Notes
  • 3.3 Release Notes
  • 3.2 Release Notes
  • 3.1 Release Notes
View Categories
  • Home
  • Docs
  • Add-Ons
  • Commerce
  • Stripe
  • Stripe

Stripe

Est. read time: 7 min read

AI Doc Summarizer Doc Summary
AI Doc Summarizer Thinking Thinking

Stripe is an Element that integrates Stripe payment processing into the Namazu Elements SDK. It wraps the Stripe Java SDK behind a single StripeService interface covering customers, one-off payments, subscriptions, Stripe-hosted Checkout and the Customer Portal, and usage-based billing via Stripe Billing Meters — and it turns Stripe’s webhook stream into strongly-typed internal events any other Element can subscribe to, without parsing a single webhook payload.


Overview #

Most of what Stripe exposes lives behind one exported Service, StripeService (package dev.getelements.elements.stripe.Service, in the api module). Any Element that declares a dependency on Stripe can inject it via the Service locator and call it directly — creating customers, charging one-off payments, managing subscriptions, resolving prices, and recording metered usage. A REST layer re-exposes the player-facing subset of that surface under an authenticated API, and a webhook receiver keeps Stripe’s own state (payments, invoices, subscriptions) in sync by publishing typed events whenever Stripe calls back.

Credentials and webhook signing secrets can be set as deployment attributes or overridden at runtime through a superuser admin panel, without a rebuild or redeploy. A small MongoDB-backed audit log records every webhook Stripe has ever sent, viewable from the same panel.


Key Features #

  • Customer, PaymentIntent, SetupIntent, and Subscription management through one StripeService interface, plus Stripe-hosted Checkout Sessions and Customer Portal sessions
  • Usage-based billing via Stripe Billing Meters, including a meter-to-price join Stripe’s own API doesn’t provide (see Products, Prices, and Billing Meters below)
  • A signature-verified webhook receiver that publishes both a raw event and, for the most common event types, a strongly-typed record via Element.publish (see Stripe Webhooks and the Typed Event Bus)
  • An authenticated REST API for front-end and server-to-server use (see Stripe REST API Reference)
  • A superuser admin UI panel for configuring credentials and browsing the webhook event log, with values persisted to MongoDB so they override the Element’s deployment attributes without a rebuild

Module Structure #

ModulePurpose
apiExported interfaces and data types: StripeService, request/response records, typed event records, and the StripeEvents name constants. Consumed by other Elements via a classified jar.
ElementREST endpoints, Guice wiring, the webhook receiver, Morphia persistence, and the admin UI plugin. Builds the .elm archive.
debugLocal runner — boots a local MongoDB replica set via Docker, then the Elements runtime with this Element loaded.
uiReact/TypeScript admin panel (built only under the build-ui Maven Profile) that registers a “Stripe” tab in the superuser dashboard for configuration and event-log viewing.
integration-testTests that exercise the real Stripe API in test mode, driven by environment variables.
consumer-testA second, independent Element demonstrating how to consume Stripe’s published events with @ElementEventConsumer.

Core Concepts #

Customers and Payment Methods #

StripeService.createCustomer(email, name, orgId) creates a Stripe Customer and stamps orgId into its Metadata under the orgId key (StripeService.METADATA_ORG_ID). Later, findCustomerByMetadata(metadataKey, metadataValue) uses the Stripe Customer Search API to look that customer back up by the same key — the recommended find-or-create pattern, so deleting and recreating an org on your side doesn’t create an orphaned duplicate Stripe customer. Neither the key nor the value may contain a single-quote character.

Before charging a customer or starting a subscription, attach a payment method via a SetupIntent: createSetupIntent(customerId) returns a client secret the front end passes to Stripe.js (stripe.confirmCardSetup) to collect a card without an immediate charge. listPaymentMethods(customerId) and the cheaper hasPaymentMethod(customerId) check what’s on file.

Note

createCustomer, createSetupIntent, listPaymentMethods, and hasPaymentMethod are StripeService methods only — they have no REST endpoint. Call them from server-side code in an Element that depends on Stripe’s api module. See Stripe REST API Reference for the full list of what is and isn’t exposed over HTTP.

One-Off Payments with PaymentIntent #

createPaymentIntent(CreatePaymentIntentRequest) creates a Stripe PaymentIntent for a single charge and returns a client secret for the front end to confirm with stripe.confirmCardPayment. The request carries the amount (in the currency’s smallest unit, e.g. cents), an ISO 4217 currency code, the target customer, optional Metadata, and an optional idempotencyKey — supplying one makes retries safe, since Stripe returns the original PaymentIntent instead of creating a second charge. A CreatePaymentIntentRequest.of(amount, currency, customerId) factory covers the common case where nothing else needs to be set.

Subscriptions #

createSubscription(customerId, CreateSubscriptionRequest) starts a recurring subscription at a given price; the customer must already have a default payment method on file. getSubscriptionStatus(subscriptionId), listSubscriptionsByCustomer(customerId, status, limit, startingAfter), and cancelSubscription(subscriptionId) round out the lifecycle — cancellation is immediate, ending access right away rather than at the end of the billing period. For end-of-period cancellation, send the customer to the Customer Portal instead.

Checkout Sessions and the Customer Portal #

Rather than building your own payment form, createCheckoutSession(CreateCheckoutSessionRequest) creates a Stripe-hosted Checkout page and returns its URL; redirecting the customer there hands Stripe the entire payment-collection flow, with Stripe redirecting back to your successUrl or cancelUrl when the customer is done. mode defaults to subscription if omitted; pass payment for a one-off charge. Metadata set on the request is stamped onto both the Checkout Session and the resulting Subscription or PaymentIntent, which is the easiest way to carry an orgId or SKU identifier through to your webhook handlers without a DAO lookup.

createBillingPortalSession(customerId, returnUrl) (exposed over REST as Create a Customer Portal Session) creates a single-use Customer Portal URL where the customer can manage their own subscriptions and payment methods with no server-side billing logic in your game at all.

Products, Prices, and Billing Meters #

listProducts, getProduct, listPrices, and retrievePrice read the Stripe product catalogue. listPrices results are cached in memory for dev.getelements.elements.stripe.price.cache.ttl.ms milliseconds (5 minutes by default) to avoid hitting Stripe on every catalogue page load.

Usage-based billing runs on Stripe Billing Meters. Stripe’s own API has no “list prices by meter” endpoint, so listMeters(activeOnly, limit) fetches meters and active recurring prices separately and joins them in memory, keyed by each price’s recurring.meter field, so each MeterSummary arrives with its billing PriceSummary already attached (or null, if no recurring price references that meter yet).

Two overloads resolve a price from a meter’s event name directly, without needing the REST of the catalogue:

  • resolvePriceForMeterEventName(eventName) — catalogue-wide, and cached (same TTL as listPrices). If more than one active price references the same meter — a customer on a legacy tier versus the current one, for example — this can only return an arbitrary match.
  • resolvePriceForMeterEventName(eventName, subscriptionId) — scoped to one subscription. It bypasses the cache and inspects that subscription’s own line items for the price actually attached to it, which is how to disambiguate the legacy-tier case above.

To report usage, call recordMeterEvent(customerId, eventName, value, idempotencyKey) with a BigDecimal quantity (e.g. 0.25) — it’s sent to Stripe as both the meter event’s deduplication identifier and the HTTP idempotency key, so a retried call never double-reports usage. If Stripe has no active meter configured for eventName, this throws NoSuchMeterException rather than surfacing Stripe’s raw error string, so callers can catch a specific type.

Webhooks and the Typed Event Bus #

Stripe calls back into a single signature-verified webhook endpoint, which publishes a raw event for every webhook it receives and, for the most common event types, a strongly-typed record other Elements can subscribe to with @ElementEventConsumer — no webhook JSON parsing required. See Stripe Webhooks and the Typed Event Bus for the full event list, Dashboard setup, and local testing with the Stripe CLI.

Configuration and Persistence #

The Stripe API key and webhook signing secret are required deployment attributes, overridable at runtime from a superuser admin panel without a rebuild. Two MongoDB collections back the Element: one holding that runtime credential override, and one logging every webhook Stripe has ever sent for audit and troubleshooting. See Configuring the Stripe Element.


Related Pages #

  • Configuring the Stripe Element — required attributes, credential precedence, multi-environment deployment, and Maven coordinates
  • Stripe Webhooks and the Typed Event Bus — webhook verification, Stripe Dashboard setup, the full typed-event table, and consuming events from another Element
  • Stripe REST API Reference — every REST endpoint, its request/response shape, and which StripeService methods are Service-only
What are your Feelings
Still stuck? How can we help?

How can we help?

Updated on August 14, 2026
Stripe REST API ReferenceConfiguring the Stripe Element
Table of Contents
  • Overview
  • Key Features
  • Module Structure
  • Core Concepts
    • Customers and Payment Methods
    • One-Off Payments with PaymentIntent
    • Subscriptions
    • Checkout Sessions and the Customer Portal
    • Products, Prices, and Billing Meters
    • Webhooks and the Typed Event Bus
    • Configuration and Persistence
  • Related Pages
  • Documentation
  • Terms of Service
  • Privacy Policy
  • Contact us
  • Linkedin
  • Join our Discord

Namazu Studios LLC is powered by Namazu Elements, an open source modular backend framework for connected games.

Namazu Elements
  • Download
  • About Elements
  • Open source
  • Documentation
  • Support
Namazu Studios
  • Case Studies
  • About Us
  • News
Best realtime game backends 2026
Get in Touch
  • info@namazustudios.com
  • Book a call
  • (619) 862-2890
  • Linkedin
  • Discord

©2008-2026 Namazu Studios. All Rights Reserved.