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-checkout: Create 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 the API and redirect to the 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/intent: Create Payment Intent with amount, currency, optional customer and metadata. Return client_secret (and optionally id) to the front end.
  2. Interface — mount Stripe’s payment form with Stripe.js, 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 Create Refund with either Payment Intent or Charge (from the payment or from a webhook payload). Provide exactly one of the two.
  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. WeWeb adds a Multi-option split on context.event.action when it creates the workflow: use its succeeded (or completed) branch.
  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