Configuration
RESTHeartrestheart-stripe is configured through the stripeConfig block.
Everything is disabled by default: enabling the module is a deliberate act.
RESTHeart uses its default configuration; you only need an override file for the settings that differ.
Quick start
Create an override file (e.g. stripe.conf):
# enable the module and set credentials
/stripeConfig/enabled -> true
/stripeConfig/secret-key -> "sk_test_..."
/stripeConfig/webhook-secret -> "whsec_..."
# enable subscriptions
/stripeConfig/subscriptions/enabled -> true
/stripeConfig/subscriptions/default-plan -> free
/stripeConfig/subscriptions/success-url -> "https://app.example.com/billing?success=true"
/stripeConfig/subscriptions/cancel-url -> "https://app.example.com/billing?canceled=true"
/stripeConfig/subscriptions/portal-return-url -> "https://app.example.com/billing"
# enable products
/stripeConfig/products/enabled -> true
/stripeConfig/products/default-currency -> eur
/stripeConfig/products/success-url -> "https://shop.example.com/done?session={CHECKOUT_SESSION_ID}"
/stripeConfig/products/cancel-url -> "https://shop.example.com/cart"
# enable the plugins you need
/stripeService/enabled -> true
/stripeInitializer/enabled -> true
/stripeWebhookService -> { "enabled": true }
# subscriptions plugins
/stripeCheckoutService/enabled -> true
/stripePortalService/enabled -> true
/stripeSubscriptionService/enabled -> true
/stripePlansService/enabled -> true
/stripeCatalogCache/enabled -> true
/stripeLicensesService/enabled -> true
# products plugins
/ordersCheckoutInterceptor/enabled -> true
/ordersCheckoutResponseInterceptor/enabled -> true
Start RESTHeart:
java -jar restheart.jar -o stripe.conf
|
Warning
|
Never write Stripe keys literally in a file that gets committed. Use environment variable expansion in the override file:
Or pass them via
|
Structure
stripeConfig:
enabled: # master switch
secret-key: # shared — Stripe API key
webhook-secret: # shared — webhook signing secret
teams-collection: # shared — default: teams
subscriptions:
enabled: # subscriptions mode on/off
default-plan: # plan for entities with no subscription
plans: # the plan catalog
success-url: # checkout redirect
cancel-url: # checkout redirect
portal-return-url: # portal return URL
notifications: # per-notification enabled flags
templates: # custom email template paths
products:
enabled: # products mode on/off
catalog-collection: # default: catalog
orders-collection: # default: orders
transactions-collection: # default: transactions
inventory-collection: # optional — omit to disable stock checks
default-currency: # default: eur
buyer-email-field: # default: _id
success-url: # checkout redirect
cancel-url: # checkout redirect
session-expires-minutes: # default: 60
max-line-items: # default: 50
max-quantity-per-line: # default: 100
automatic-tax: # default: true
shipping-options: # for physical products
notifications: # order-confirmed, order-refunded
init-enabled: # default: true, set false for multi-tenant on-demand init
Credentials and database are shared across both modes. Each mode has its own sub-section.
Shared keys
| Key | Default | Description |
|---|---|---|
|
|
Master switch for the module. |
|
(none) |
Stripe secret API key. Required. |
|
(none) |
Webhook signing secret. Required. |
|
|
Collection holding team documents. |
The MongoDB database is sourced from mongoRealmAuthenticator.users-db, not from stripeConfig.
This prevents the two modules from drifting apart:
/mongoRealmAuthenticator/users-db -> "myapp"
Subscriptions keys
| Key | Default | Description |
|---|---|---|
|
|
Subscriptions mode on/off. |
|
|
Plan id for entities with no subscription. |
|
|
Fallback trial days. |
|
(empty) |
Checkout redirect after payment. |
|
(empty) |
Checkout redirect on abandonment. |
|
(empty) |
Customer Portal return URL. |
|
(empty) |
Plan catalog. See Plans & Seats. |
Products keys
| Key | Default | Description |
|---|---|---|
|
|
Products mode on/off. |
|
|
Product definitions. |
|
|
Order documents. |
|
|
Money ledger. |
|
(none) |
Stock data. Omit to disable stock checks. |
|
|
Currency when a product has none. |
|
|
User-document field for buyer email. |
|
(empty) |
Checkout redirect after payment. |
|
(empty) |
Checkout redirect on abandonment. |
|
|
Checkout session lifetime. |
|
|
Maximum items per cart. |
|
|
Maximum quantity per item. |
|
|
Enable Stripe Tax. |
|
|
Set |
Plugins
Each plugin is enabled independently.
| Plugin | Role |
|---|---|
|
Reads the |
|
Holds the |
|
Validates config, creates indexes, registers |
|
|
Subscriptions: |
|
|
|
|
|
|
|
|
|
|
|
|
Display data cache for |
Products: |
|
|
Validates cart, creates Checkout session |
|
Adds |
Startup validation
stripeInitializer runs before the HTTP server starts and logs errors when:
-
secret-keyorwebhook-secretis missing -
default-plandoes not name a declared plan (subscriptions only)
|
Important
|
RESTHeart catches initializer exceptions and logs them — it does not abort startup. Check the log for |
On success:
[stripe] plugin initialised — mode=TEST, db=myapp, subscriptions=true, products=true
Notifications
Subscriptions
| Notification | Default | Sent when |
|---|---|---|
|
|
Invoice payment fails |
|
|
Trial ending in 3 days |
|
|
Subscription deleted |
|
|
Seat limit exceeded |
Products
| Notification | Default | Sent when |
|---|---|---|
|
|
Order paid |
|
|
Refund recorded |
Notifications use the emails plugin. If absent, they are silently skipped.
Complete example
# stripe.conf — override file for restheart-stripe
/mongoRealmAuthenticator/users-db -> "myapp"
# ── shared ──
/stripeConfig/enabled -> true
/stripeConfig/secret-key -> "${STRIPE_SECRET_KEY}"
/stripeConfig/webhook-secret -> "${STRIPE_WEBHOOK_SECRET}"
# ── subscriptions ──
/stripeConfig/subscriptions/enabled -> true
/stripeConfig/subscriptions/default-plan -> free
/stripeConfig/subscriptions/default-trial-period-days -> 14
/stripeConfig/subscriptions/success-url -> "https://app.example.com/billing?success=true"
/stripeConfig/subscriptions/cancel-url -> "https://app.example.com/billing?canceled=true"
/stripeConfig/subscriptions/portal-return-url -> "https://app.example.com/billing"
/stripeConfig/subscriptions/plans -> {
"free": { "seats": { "mode": "capped", "max": 1 } },
"gold": {
"price-id-monthly": "price_xxx",
"price-id-annual": "price_yyy",
"trial-period-days": 30,
"seats": { "mode": "capped", "max": 10 }
}
}
# ── products ──
/stripeConfig/products/enabled -> true
/stripeConfig/products/default-currency -> eur
/stripeConfig/products/buyer-email-field -> _id
/stripeConfig/products/success-url -> "https://shop.example.com/done?session={CHECKOUT_SESSION_ID}"
/stripeConfig/products/cancel-url -> "https://shop.example.com/cart"
/stripeConfig/products/automatic-tax -> true
# ── plugins ──
/stripeService/enabled -> true
/stripeInitializer/enabled -> true
/stripeWebhookService -> { "enabled": true }
/stripeCheckoutService/enabled -> true
/stripePortalService/enabled -> true
/stripeSubscriptionService/enabled -> true
/stripePlansService/enabled -> true
/stripeCatalogCache/enabled -> true
/stripeLicensesService/enabled -> true
/ordersCheckoutInterceptor/enabled -> true
/ordersCheckoutResponseInterceptor/enabled -> true