elements
Start Docs Blog Demos UI Pricing
Elements Manual
  • Getting Started
  • CLI
  • Build
  • Browser
  • Packages
  • TypeScript
  • Elements HTML
  • Assets
  • RPC
  • Router
  • Session
  • Database
  • Migrations
  • LiveTable
  • Channel
  • Jobs
  • Email
  • Payments
    • Payments Setup
    • Checkout
    • The Webhook
    • Subscriptions
    • Going Live
  • JSON
  • Async
  • Style
  • UI
  • JSOC
  • Config
  • Tests
  • Logs
  • Deploy
  • Editors
  • Recipes
  • Licenses
  • Issues
  • Changelog
Manual / Payments

Payments

elements man payments

On This Page

  • Topics

Take card payments with Stripe Checkout. Stripe hosts the checkout page and holds the card data, so the app never touches a card number.

The owner supplies one value: a Stripe secret key. The app does these things itself:

  • Prices come from the app's own rows. Checkout Sessions carry them inline (price_data), so nobody creates products or copies price ids in the Stripe dashboard.
  • The app fulfills a payment when the buyer returns, by asking Stripe for the session's state, and again when the webhook arrives. The return page and the webhook both call one idempotent function, so development needs no webhook.
  • In production the app registers its own webhook endpoint through the Stripe API, the first time a buyer starts a checkout, and keeps the signing secret. Nobody copies a whsec_ value.

Until the key is set, the app still takes payments in development. The pay button opens a test checkout page inside the app: the order summary, the total, and a Pay button that records the payment through the same function a real payment uses. Every feature that depends on a payment (paid status, receipts, live updates) works and can be tested before the owner has a Stripe account. Once the key is set, the same button goes to real Stripe Checkout. Production never runs without a key: the build fails when it is missing, and the app refuses to start when it is empty.

The official stripe npm package works as is: elements install stripe. Build the pages in order: setup, checkout, webhook, then subscriptions if the app sells recurring plans.

Never ask the user to paste a secret key into chat or into a committed file, and never put a secret key in browser-reachable code. Never collect a card number in the app, not even on the test checkout page.

Topics

payments/setup The one key, the Stripe client, and failing in production without it.payments/checkout The payments table, a checkout rpc with inline prices, the test checkout, and fulfillment on return.payments/webhook The webhook route, and the app registering its own endpoint on the first checkout in production.payments/subscriptions Recurring prices, renewals, and cancel from inside the app.payments/live Going live: one live key and a deploy.
Prev EmailNext Payments Setup
Product
Manual Pricing Compare
Company
History Contact
Legal
Privacy Policy Acceptable Use Terms License Agreement
© Elements Dev Corporation 2026