Skip to content

Updating visuals

If you see any images containing outdated UI, please bear with us.

We are updating all content as quickly as possible to mirror our new UI.

Payment Intents and subscriptions

This page covers two flows: one-time payments using Payment Intents (with a payment form in your app) and subscriptions (recurring charges) created from your backend.

Handling payments in a real app

  • Never store card numbers — Card data stays in Stripe. You use Stripe’s UI (Checkout or the payment element) to collect it; your backend only tells Stripe what to charge.
  • Use a Stripe customer per user — In most apps, each signed-in user has a Stripe Customer. Store the customer ID (cus_...) in your database so you can charge them again or create subscriptions.
  • Use the backend for the charge — Create or update Stripe objects from Data & API → APIs (or backend workflows), and return only what your interface needs (e.g. client_secret, url, or a success flag).

One-time payments (Payment Intents)

Use this when you charge once (e.g. a single purchase) and you want the payment form inside your app (e.g. via the Stripe plugin).

Flow

  1. Create or reuse a customer — When a user pays for the first time, use Create Customer and save the returned Customer ID (cus_...) in your database (e.g. on the user record).
  2. Create a Payment Intent — In an API (e.g. POST /payments/intent), use Create Payment Intent with:
    • Amount (in cents) and Currency
    • Customer (your saved cus_..., if you have it)
    • Optional: Receipt Email, Description, Metadata (e.g. order ID)
  3. Return the client_secret (and optionally the Payment Intent id) to the front end.
  4. Collect payment in the interface — Use the Stripe plugin’s payment element (or Stripe.js) with that client_secret. On submit, Stripe confirms the payment.
  5. Handle success and refunds — To refund, use Refund Payment with the Payment Intent ID (or Charge ID).

What to store in your database

  • Customer IDcus_... for the signed-in user.
  • Payment Intent IDpi_... for support and refunds.
  • Your own reference — e.g. order ID in Metadata.

Subscriptions

Use subscriptions when you charge repeatedly (e.g. monthly access to a plan).

Flow

  1. Create products and prices in Stripe — Use Create Product for the plan and Create Price with Recurring (e.g. {"interval":"month"}).
  2. Create or reuse a customer — If the user doesn’t have a Stripe customer yet, use Create Customer and store cus_....
  3. Create the subscription — In an API (e.g. POST /subscriptions), use Create Subscription with:
    • Customer = your stored cus_...
    • Items = at least one item with a Price (price_...)
  4. Keep your app in sync — Use Retrieve Subscription or List Subscriptions to check status (active, canceled, etc.). Use Update Subscription to change plans and Cancel Subscription (or cancel at period end) to stop access.

What to store in your database

  • Customer IDcus_...
  • Subscription IDsub_... for that user.
  • Price IDprice_... so you can show their plan and handle upgrades/downgrades.

You can also offer subscriptions via Stripe Checkout (mode subscription); see Stripe Checkout.


Next: Webhooks or Workflow examples