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.

Workflow examples

These examples show how to wire up common payment flows using Stripe actions and webhooks in WeWeb.

One-time payment with Stripe Checkout

  1. API: POST /create-checkout — Create Customer (if new), then Create Checkout Session with mode payment, line items (price IDs and quantities), success/cancel URLs, and metadata (e.g. order ID).
  2. Interface: A “Pay” button calls that API and redirects to response.url.
  3. Success page (optional): Call Retrieve Checkout Session with the session_id from the URL to show order details.
  4. Webhook (optional): Backend workflow On checkout session event → filter for action === 'completed' → update your orders table, send receipt email, or grant access.

Subscription with Stripe Checkout

  1. API: POST /create-subscription-checkoutCreate Checkout Session with mode subscription, line items with a recurring price ID, success/cancel URLs. Optionally Subscription Data (e.g. trial_period_days: 14).
  2. Interface: Same as above — call API, redirect to session URL.
  3. Webhook: On subscription event → when created or updated, store subscription.id and status in your database; use context.event.status (e.g. active, canceled) to control access.

One-time payment with Payment Intent (custom form)

  1. API: POST /payments/intentCreate Payment Intent with amount, currency, optional customer and metadata. Return client_secret (and optionally id) to the front end.
  2. Interface: Use the Stripe plugin payment element bound to that client_secret. On submit, Stripe confirms the payment.
  3. Success: Redirect or show confirmation; optionally call Retrieve Payment Intent to show status.
  4. Webhook (recommended): On payment intent event → when succeeded → update order, grant access, or send email.

Refund after payment

  1. Use Refund Payment with either Payment Intent ID or Charge ID (from the payment or from a webhook payload).
  2. Optionally set Amount (in cents) for a partial refund; leave empty for full refund.
  3. Set Reason (e.g. requested_by_customer) for your records.

Grant access when payment succeeds (webhook)

  1. Backend workflow: trigger On payment intent event (or On checkout session event).
  2. First action: Switch on context.event.action → branch on succeeded (or completed).
  3. In that branch: update your users or orders table (e.g. set plan = 'premium', paid_at = now) using the customer ID or metadata from context.event.

Reference: Actions reference · Errors and FAQs