Appearance
Stripe Checkout
Stripe Checkout is a hosted page where customers enter their payment details. You create a Checkout Session from your backend and redirect the user to it; Stripe handles the rest and sends them back to your site.
How it works
- Your backend creates a Checkout Session (with line items, success/cancel URLs, and mode).
- Your app gets the session
urlfrom the response and redirects the customer there (e.g. “Pay” button). - Stripe shows the payment page, collects the payment, and redirects to your Success or Cancel URL.
- Optional: A webhook runs when the session is completed so you can update your database or send a receipt.
Step 1: Create products and prices in Stripe
Before you can add line items to Checkout, Stripe needs at least one Price (and usually a Product). You can:
- Create them in the Stripe Dashboard, or
- Use the Create Product and Create Price actions from a WeWeb workflow or API.
For a subscription, create a recurring price (e.g. monthly). Note the Price ID (e.g. price_123...).
Step 2: Create an API that creates a Checkout Session
- In WeWeb, go to Data & API → APIs and create a new API (e.g.
POST /create-checkout). - In the workflow for that API, add the Stripe action Create Checkout Session.
- Configure:
- Mode —
payment(one-time) orsubscription(recurring). - Line Items — e.g.
[{ "price": "price_123...", "quantity": 1 }](use your Stripe Price IDs). - Success URL — e.g.
https://yoursite.com/success?session_id={CHECKOUT_SESSION_ID}. Stripe replaces{CHECKOUT_SESSION_ID}with the real ID. - Cancel URL — e.g.
https://yoursite.com/cancel. - Customer or Customer Email (optional).
- Metadata (optional) — e.g. order ID for your records.
- Mode —
- Return the session’s
url(and optionallyid) in the API response.
For subscriptions, you can add Subscription Data (e.g. { "trial_period_days": 14 }).
Step 3: Redirect the customer from your interface
On the page where the user clicks “Pay” (or “Subscribe”):
- Call the API you created (e.g.
POST /create-checkout) with the right body (e.g. price ID, quantity). - From the response, take the session
url. - Redirect: e.g.
window.location.href = response.url.
The customer will land on Stripe’s page, pay, and then be sent to your Success or Cancel URL.
Step 4: (Optional) Use the success page or a webhook
- Success page: You can call Retrieve Checkout Session with the
session_idfrom the URL to show order details or confirmation. - Webhook: Create a backend workflow with trigger On checkout session event. When
context.event.actioniscompleted, update your orders table, send a receipt, or grant access. See Webhooks.
Main inputs at a glance
| Input | Example | Description |
|---|---|---|
| Mode | payment | payment (one-time), subscription, or setup |
| Line Items | [{"price":"price_123","quantity":1}] | Required for payment/subscription. Use Stripe Price IDs. |
| Success URL | https://yoursite.com/success?session_id={CHECKOUT_SESSION_ID} | Where to send the customer after success. |
| Cancel URL | https://yoursite.com/cancel | Where to send the customer if they cancel. |
| Customer | cus_xxx | Optional. Existing Stripe customer ID. |
| Customer Email | user@example.com | Optional. Used when no Customer ID is provided. |
| Metadata | {"order_id":"123"} | Optional. Available in webhooks. |
Full parameter list: Actions reference → Create Checkout Session.

