DeepSpace ships a Stripe-backed payment system. You declare your plans and products in two manifest files; the SDK gives you hooks for paywalls, checkouts, and self-service billing. The platform charges customers and routes funds to your connected Stripe account. You don’t write Stripe code, register webhooks, or hold API keys. You don’t even need a Stripe account to start declaring plans - funds accumulate until you connect your Stripe account in the DeepSpace dashboard.Documentation Index
Fetch the complete documentation index at: https://docs.deep.space/llms.txt
Use this file to discover all available pages before exploring further.
Declare what you sell
Two manifest files define the catalog. Edit, then runnpx deepspace deploy to sync Products and Prices to Stripe.
Subscription plans - src/subscriptions.ts
One-time products - src/products.ts
Subscribe a user
Callsubscribe() from useSubscription. The hook navigates the browser to Stripe Checkout; the user lands back on your app with their subscription active.
<PricingTable /> and wire its onSelect to subscribe:
useSubscription also exposes openPortal() for self-service billing - point a “Manage billing” button at it.
Gate a server route
The client checks are for UX only - anyone can call your API directly. Gate sensitive routes withrequireSubscription from 'deepspace/server':
getSubscription for the read-only variant that returns the subscription object without throwing.
One-time charges
useCheckout handles non-recurring purchases in two modes - product mode for durable entitlements declared in src/products.ts, and ad-hoc mode for tips and donations.
- Product mode
- Ad-hoc mode
Pass the same Product entitlements survive across sessions and devices - the platform tracks them per user.
productId to the hook and to chargeOnce. The hook exposes owned so you can gate UI before the user pays.Cancel a subscription
cancelSubscription cancels one user, or every user on a given plan slug. The inbound request must carry the app-owner’s JWT.
atPeriodEnd: false for immediate cancellation.
Issue a refund
refundInvoice refunds a charge by its local invoice ID. Wrap it behind your own admin check.
paidAt, 50 refunds per 24h per app, no overdraw on partials. Dashboard-initiated refunds reconcile automatically.
Common pitfalls
Tier ≠ entitled
Tier ≠ entitled
A
past_due subscriber keeps their tier slug but loses access. Always gate on hasTier() / isAtLeast() on the client, and requireSubscription on the server - all three check status, not just slug.`currentPeriodEnd` is Unix milliseconds
`currentPeriodEnd` is Unix milliseconds
currentPeriodEnd and trialEndsAt are Unix milliseconds. Pass them straight to new Date() - no multiplication needed.Below-minimum prices fail at deploy
Below-minimum prices fail at deploy
Subscription minimums are 12/year. One-time minimum is $1.00. Below these, Stripe’s per-charge fee consumes the entire price. The deploy worker rejects the manifest before syncing to Stripe.
Never rename a plan's slug
Never rename a plan's slug
The slug is the stable identifier for existing subscribers, server-side gates, and the underlying Stripe Product. Renaming on deploy is interpreted as “delete + create” - existing subscribers stay billed on the orphaned price. For branding changes, edit
name instead.Local state lags Checkout by 1–2 seconds
Local state lags Checkout by 1–2 seconds
The Stripe webhook fires shortly after the user returns from Checkout. Call
sub.refresh() / co.refresh() once on return. If state is still stale, refresh again on user action - don’t write a tight retry loop.Connect onboarding lives in the dashboard, not your app
Connect onboarding lives in the dashboard, not your app
Developer Stripe Connect onboarding happens at dashboard.deep.space/earnings, outside your app. Don’t build any Stripe Connect UI yourself. Funds accumulate on the platform balance until onboarding completes.
Next steps
- Payments reference - full prop, option, and return-shape tables.
- Authentication - gate UI behind sign-in.
- Server actions - admin-only routes for cancellations and refunds.